之前的lazarus在linux下使用搜狗输入法输入词组时只能输入第一个字,经网友yoozaa和谐^_^提醒,今天终于解决词组输入的Bug。
打开/lazarus/lcl/interfaces/gtk2/gtk2widgetset.inc
将第247--249注释,第251行添加:
im_context_string:='';//添加这行
最后重新编译lazarus就可以完美兼容搜狗输入法。
procedure gtk_commit_cb ({%H-}context: PGtkIMContext; const Str: Pgchar; {%H-}Data: Pointer); cdecl; {$IFDEF WITH_GTK2_IM} var control:TWinControl; i:Integer; {$ENDIF} begin {$IFDEF WITH_GTK2_IM} //DebugLn(['gtk_commit_cb ',dbgstr(Str),'="',Str,'"']); { fix double normal character input } //if not im_context_use then //将这3行注释 // im_context_string:=Str // key at non-composition //将这3行注释 // else //将这3行注释 im_context_string_commit:=Str; // key at composition im_context_string:='';//添加这行 { commit composition string, not key } if (im_context_widget<>nil) then begin im_context_skipdelete:=True; Control:=TWinControl(GetNearestLCLObject(im_context_widget)); SendMessage(control.Handle,LM_IM_COMPOSITION,GTK_IM_FLAG_COMMIT,LPARAM(pchar(im_context_string_commit))); im_context_string_commit:=''; end; {$ELSE} im_context_string:=Str; {$ENDIF} end;
标签:搜狗,输入法,Str,string,lazarus,im,context,linux,commit From: https://www.cnblogs.com/qiufeng2014/p/17073239.html