From 3a8314cc2b7f4cbc8bc90f9a6dc395d2a64eca3a Mon Sep 17 00:00:00 2001 From: "jenglish@flightlab.com" Date: Fri, 20 Jan 2006 18:42:04 +0000 Subject: XIM fixes [See #905830, patch tk84-xim-fixes.patch]: + Revert 2005-12-05 patch disabling XIM when SCIM in use; + Make sure all X events get passed to XFilterEvent, including those without a corresponding Tk window. --- ChangeLog | 7 +++++++ generic/tkEvent.c | 8 +++++--- unix/tkUnixEvent.c | 42 ++++++++++++------------------------------ 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc32000..52f4f81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-01-20 Joe English + * generic/tkEvent.c, unix/tkUnixEvent.c: XIM fixes + [See #905830, patch tk84-xim-fixes.patch]. + + Revert 2005-12-05 patch disabling XIM when SCIM in use; + + Make sure all X events get passed to XFilterEvent, + including those without a corresponding Tk window. + 2006-01-10 Daniel Steffen * macosx/tkMacOSXDraw.c: re-added inclusion of tclInt.h to allow access diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 145d5d7..1eb7944 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEvent.c,v 1.17.2.7 2005/11/30 21:13:12 hobbs Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.17.2.8 2006/01/20 18:42:04 jenglish Exp $ */ #include "tkPort.h" @@ -948,8 +948,10 @@ Tk_HandleEvent(eventPtr) XSetICFocus(winPtr->inputContext); } } - if (XFilterEvent(eventPtr, None)) { - goto done; + if (eventPtr->type == KeyPress || eventPtr->type == KeyRelease) { + if (XFilterEvent(eventPtr, None)) { + goto done; + } } } #endif /* TK_USE_INPUT_METHODS */ diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 0b13c71..d15d175 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixEvent.c,v 1.11.2.5 2005/12/05 22:40:08 hobbs Exp $ + * RCS: @(#) $Id: tkUnixEvent.c,v 1.11.2.6 2006/01/20 18:42:04 jenglish Exp $ */ #include "tkInt.h" @@ -343,19 +343,22 @@ static void TransferXEventsToTcl(display) Display *display; { - int numFound; XEvent event; - numFound = QLength(display); - /* - * Transfer events from the X event queue to the Tk event queue. + * Transfer events from the X event queue to the Tk event queue + * after XIM event filtering. KeyPress and KeyRelease events + * are filtered in Tk_HandleEvent instead of here, so that Tk's + * focus management code can redirect them. */ - - while (numFound > 0) { + while (QLength(display) > 0) { XNextEvent(display, &event); + if (event.type != KeyPress && event.type != KeyRelease) { + if (XFilterEvent(&event, None)) { + continue; + } + } Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); - numFound--; } } @@ -650,31 +653,10 @@ OpenIM(dispPtr) { unsigned short i; XIMStyles *stylePtr; - char *modifiers; - modifiers = XSetLocaleModifiers(""); - if (modifiers == NULL) { + if (XSetLocaleModifiers("") == NULL) { goto error; } -#if 1 - /* - * This is a temporary hack that can be taken back out again - * once Tk has learned how to deal with SCIM - */ - while ((modifiers = strchr(modifiers, '@')) != NULL) { - if (strncmp(modifiers, "@im=", 4) == 0) { - /* The first "@im=" entry wins */ - const char *scim = "@im=SCIM"; - if (strncmp(modifiers, scim, strlen(scim)) == 0) { - /* If it is SCIM, we override it */ - if (XSetLocaleModifiers("@im=local") == NULL) { - goto error; - } - } - break; - } - } -#endif dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL); if (dispPtr->inputMethod == NULL) { -- cgit v0.12