diff options
Diffstat (limited to 'nx-X11/lib/X11/imDefLkup.c')
-rw-r--r-- | nx-X11/lib/X11/imDefLkup.c | 134 |
1 files changed, 72 insertions, 62 deletions
diff --git a/nx-X11/lib/X11/imDefLkup.c b/nx-X11/lib/X11/imDefLkup.c index d1c3a6567..af39008bc 100644 --- a/nx-X11/lib/X11/imDefLkup.c +++ b/nx-X11/lib/X11/imDefLkup.c @@ -34,7 +34,7 @@ PERFORMANCE OF THIS SOFTWARE. #include "Xlcint.h" #include "Ximint.h" -Public Xic +Xic _XimICOfXICID( Xim im, XICID icid) @@ -48,7 +48,7 @@ _XimICOfXICID( return (Xic)0; } -Private void +static void _XimProcIMSetEventMask( Xim im, XPointer buf) @@ -60,7 +60,7 @@ _XimProcIMSetEventMask( return; } -Private void +static void _XimProcICSetEventMask( Xic ic, XPointer buf) @@ -73,7 +73,7 @@ _XimProcICSetEventMask( return; } -Public Bool +Bool _XimSetEventMaskCallback( Xim xim, INT16 len, @@ -98,7 +98,7 @@ _XimSetEventMaskCallback( return False; } -Private Bool +static Bool _XimSyncCheck( Xim im, INT16 len, @@ -127,7 +127,7 @@ _XimSyncCheck( return False; } -Public Bool +Bool _XimSync( Xim im, Xic ic) @@ -162,7 +162,7 @@ _XimSync( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(len); + preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { @@ -185,7 +185,7 @@ _XimSync( return True; } -Public Bool +Bool _XimProcSyncReply( Xim im, Xic ic) @@ -208,22 +208,18 @@ _XimProcSyncReply( return True; } -Public Bool +Bool _XimRespSyncReply( Xic ic, BITMASK16 mode) { - if (mode & XimSYNCHRONUS) /* SYNC Request */ { - if (IS_FOCUSED(ic)) - MARK_NEED_SYNC_REPLY(ic); - else - _XimProcSyncReply((Xim)ic->core.im, ic); - } + if (mode & XimSYNCHRONUS) /* SYNC Request */ + MARK_NEED_SYNC_REPLY(ic->core.im); return True; } -Public Bool +Bool _XimSyncCallback( Xim xim, INT16 len, @@ -244,7 +240,7 @@ _XimSyncCallback( return False; } -Private INT16 +static INT16 _XimSetEventToWire( XEvent *ev, xEvent *event) @@ -256,7 +252,7 @@ _XimSetEventToWire( return sz_xEvent; } -Private Bool +static Bool _XimForwardEventCore( Xic ic, XEvent *ev, @@ -273,6 +269,8 @@ _XimForwardEventCore( int ret_code; INT16 len; + bzero(buf32, sizeof(buf32)); /* valgrind noticed uninitialized memory use! */ + if (!(len = _XimSetEventToWire(ev, (xEvent *)&buf_s[4]))) return False; /* X event */ @@ -304,7 +302,7 @@ _XimForwardEventCore( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(len); + preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { @@ -328,7 +326,7 @@ _XimForwardEventCore( return True; } -Public Bool +Bool _XimForwardEvent( Xic ic, XEvent *ev, @@ -342,7 +340,7 @@ _XimForwardEvent( return _XimForwardEventCore(ic, ev, sync); } -Private void +static void _XimProcEvent( Display *d, Xic ic, @@ -356,11 +354,11 @@ _XimProcEvent( ev->xany.serial |= serial << 16; ev->xany.send_event = False; ev->xany.display = d; - MARK_FABLICATED(ic); + MARK_FABRICATED(ic->core.im); return; } -Private Bool +static Bool _XimForwardEventRecv( Xim im, Xic ic, @@ -379,7 +377,7 @@ _XimForwardEventRecv( return True; } -Public Bool +Bool _XimForwardEventCallback( Xim xim, INT16 len, @@ -400,7 +398,7 @@ _XimForwardEventCallback( return False; } -Private Bool +static Bool _XimRegisterTriggerkey( Xim im, XPointer buf) @@ -419,7 +417,7 @@ _XimRegisterTriggerkey( len = buf_l[0]; /* length of on-keys */ len += sizeof(INT32); /* sizeof length of on-keys */ - if (!(key = (CARD32 *)Xmalloc(len))) { + if (!(key = Xmalloc(len))) { _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } @@ -436,7 +434,7 @@ _XimRegisterTriggerkey( len = buf_l[0]; /* length of off-keys */ len += sizeof(INT32); /* sizeof length of off-keys */ - if (!(key = (CARD32 *)Xmalloc(len))) { + if (!(key = Xmalloc(len))) { _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } @@ -447,7 +445,7 @@ _XimRegisterTriggerkey( return True; } -Public Bool +Bool _XimRegisterTriggerKeysCallback( Xim xim, INT16 len, @@ -461,7 +459,7 @@ _XimRegisterTriggerKeysCallback( return True; } -Public EVENTMASK +EVENTMASK _XimGetWindowEventmask( Xic ic) { @@ -474,7 +472,7 @@ _XimGetWindowEventmask( } -Private Bool +static Bool _XimTriggerNotifyCheck( Xim im, INT16 len, @@ -503,7 +501,7 @@ _XimTriggerNotifyCheck( return False; } -Public Bool +Bool _XimTriggerNotify( Xim im, Xic ic, @@ -548,7 +546,7 @@ _XimTriggerNotify( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(len); + preply = Xmalloc(len); ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimTriggerNotifyCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { @@ -571,7 +569,7 @@ _XimTriggerNotify( return True; } -Private Bool +static Bool _XimRegCommitInfo( Xic ic, char *string, @@ -581,7 +579,7 @@ _XimRegCommitInfo( { XimCommitInfo info; - if (!(info = (XimCommitInfo)Xmalloc(sizeof(XimCommitInfoRec)))) + if (!(info = Xmalloc(sizeof(XimCommitInfoRec)))) return False; info->string = string; info->string_len = string_len; @@ -592,7 +590,7 @@ _XimRegCommitInfo( return True; } -Private void +static void _XimUnregCommitInfo( Xic ic) { @@ -601,16 +599,15 @@ _XimUnregCommitInfo( if (!(info = ic->private.proto.commit_info)) return; - if (info->string) - Xfree(info->string); - if (info->keysym) - Xfree(info->keysym); + + Xfree(info->string); + Xfree(info->keysym); ic->private.proto.commit_info = info->next; Xfree(info); return; } -Public void +void _XimFreeCommitInfo( Xic ic) { @@ -619,7 +616,7 @@ _XimFreeCommitInfo( return; } -Private Bool +static Bool _XimProcKeySym( Xic ic, CARD32 sym, @@ -628,7 +625,7 @@ _XimProcKeySym( { Xim im = (Xim)ic->core.im; - if (!(*xim_keysym = (KeySym *)Xmalloc(sizeof(KeySym)))) { + if (!(*xim_keysym = Xmalloc(sizeof(KeySym)))) { _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } @@ -639,7 +636,7 @@ _XimProcKeySym( return True; } -Private Bool +static Bool _XimProcCommit( Xic ic, BYTE *buf, @@ -650,7 +647,7 @@ _XimProcCommit( Xim im = (Xim)ic->core.im; char *string; - if (!(string = (char *)Xmalloc(len + 1))) { + if (!(string = Xmalloc(len + 1))) { _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } @@ -663,7 +660,7 @@ _XimProcCommit( return True; } -Private Bool +static Bool _XimCommitRecv( Xim im, Xic ic, @@ -691,22 +688,26 @@ _XimCommitRecv( return False; if (!(_XimProcCommit(ic, (BYTE *)&buf_s[5], - (int)buf_s[4], &string, &string_len))) + (int)buf_s[4], &string, &string_len))) { + Xfree(keysym); return False; + } } if (!(_XimRegCommitInfo(ic, string, string_len, keysym, keysym_len))) { - if (string) - Xfree(string); - if (keysym) - Xfree(keysym); + Xfree(string); + Xfree(keysym); _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } (void)_XimRespSyncReply(ic, flag); - MARK_FABLICATED(ic); + if (ic->private.proto.registed_filter_event + & (KEYPRESS_MASK | KEYRELEASE_MASK)) + MARK_FABRICATED(im); + + bzero(&ev, sizeof(ev)); /* uninitialized : found when running kterm under valgrind */ ev.type = KeyPress; ev.send_event = False; @@ -715,12 +716,21 @@ _XimCommitRecv( ev.keycode = 0; ev.state = 0; + ev.time = 0L; + ev.serial = LastKnownRequestProcessed(im->core.display); + /* FIXME : + I wish there were COMMENTs (!) about the data passed around. + */ +#if 0 + fprintf(stderr,"%s,%d: putback k press FIXED ev.time=0 ev.serial=%lu\n", __FILE__, __LINE__, ev.serial); +#endif + XPutBackEvent(im->core.display, (XEvent *)&ev); return True; } -Public Bool +Bool _XimCommitCallback( Xim xim, INT16 len, @@ -741,7 +751,7 @@ _XimCommitCallback( return False; } -Public void +void _XimProcError( Xim im, Xic ic, @@ -750,7 +760,7 @@ _XimProcError( return; } -Public Bool +Bool _XimErrorCallback( Xim xim, INT16 len, @@ -779,7 +789,7 @@ _XimErrorCallback( return True; } -Public Bool +Bool _XimError( Xim im, Xic ic, @@ -823,7 +833,7 @@ _XimError( return True; } -Private int +static int _Ximctsconvert( XlcConv conv, char *from, @@ -889,7 +899,7 @@ _Ximctsconvert( return to_cnvlen; } -Public int +int _Ximctstombs(XIM xim, char *from, int from_len, char *to, int to_len, Status *state) { @@ -897,7 +907,7 @@ _Ximctstombs(XIM xim, char *from, int from_len, from, from_len, to, to_len, state); } -Public int +int _Ximctstowcs( XIM xim, char *from, @@ -965,7 +975,7 @@ _Ximctstowcs( return to_cnvlen; } -Public int +int _Ximctstoutf8( XIM xim, char *from, @@ -978,7 +988,7 @@ _Ximctstoutf8( from, from_len, to, to_len, state); } -Public int +int _XimProtoMbLookupString( XIC xic, XKeyEvent *ev, @@ -1041,7 +1051,7 @@ _XimProtoMbLookupString( return ret; } -Public int +int _XimProtoWcLookupString( XIC xic, XKeyEvent *ev, @@ -1104,7 +1114,7 @@ _XimProtoWcLookupString( return ret; } -Public int +int _XimProtoUtf8LookupString( XIC xic, XKeyEvent *ev, |