From c8d74f5c2a1523409429ea72938d072f168d149d Mon Sep 17 00:00:00 2001 From: graemeg Date: Sat, 1 Mar 2008 18:37:40 +0000 Subject: * Applied patch from Vladmir which enables Unicode text input under Linux. --- src/corelib/x11/gfx_x11.pas | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas index 3dea8c4f..55dfc995 100644 --- a/src/corelib/x11/gfx_x11.pas +++ b/src/corelib/x11/gfx_x11.pas @@ -566,7 +566,8 @@ end; function TfpgApplicationImpl.StartComposing(const Event: TXEvent): TKeySym; begin SetLength(FComposeBuffer, - XLookupString(@Event, @FComposeBuffer[1], + // XLookupString(@Event, @FComposeBuffer[1], + Xutf8LookupString(InputContext, @Event.xkey, @FComposeBuffer[1], SizeOf(FComposeBuffer) - 1, @Result, @FComposeStatus)); end; @@ -762,7 +763,8 @@ var writeln('not a key event '); end; end; - length := XLookupString(@event, @s[1], 9, @keysym, @compose_status); + // length := XLookupString(@event, @s[1], 9, @keysym, @compose_status); + length := Xutf8LookupString(InputContext, @event.xkey, @s[1], 9, @keysym, @compose_status); SetLength(s, length); if((length > 0) and (length <=9)) then writeln('result of xlookupstring [' + s + ']'); @@ -846,10 +848,15 @@ begin // Maybe in the future we can switch to XmbLookupString again. if (ev.xkey.state and (ControlMask or Mod1Mask)) = 0 then begin - for i := 1 to Length(FComposeBuffer) do + {for i := 1 to Length(FComposeBuffer) do begin msgp.keyboard.keychar := FComposeBuffer[i]; fpgPostMessage(nil, w, FPGM_KEYCHAR, msgp); + end;} + for i := 1 to UTF8Length(FComposeBuffer) do + begin + msgp.keyboard.keychar := UTF8Copy(FComposeBuffer, i, 1); + fpgPostMessage(nil, w, FPGM_KEYCHAR, msgp); end; end; end { if } -- cgit v1.2.3-70-g09d2