summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-01-01 23:03:42 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-01-01 23:03:42 (GMT)
commitaa4c765febd5c742dbc658574c6a06d4e94fdc59 (patch)
treefe2654888e979765a3b62105e2c73fdee4cf4442 /generic
parent5834454dfdb57f33bae61fb49206c33584e05ee6 (diff)
downloadtk-aa4c765febd5c742dbc658574c6a06d4e94fdc59.zip
tk-aa4c765febd5c742dbc658574c6a06d4e94fdc59.tar.gz
tk-aa4c765febd5c742dbc658574c6a06d4e94fdc59.tar.bz2
[Bug 1924761]: Consolidate calls to XFilterEvent to make input methods work.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkEvent.c78
-rw-r--r--generic/tkInt.h7
2 files changed, 22 insertions, 63 deletions
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 2a13871..d298f46 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -12,7 +12,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.35.2.2 2009/01/11 19:29:42 georgeps Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.35.2.3 2010/01/01 23:03:42 dkf Exp $
*/
#include "tkInt.h"
@@ -212,7 +212,6 @@ static int TkXErrorHandler(ClientData clientData,
static void UpdateButtonEventState(XEvent *eventPtr);
static int WindowEventProc(Tcl_Event *evPtr, int flags);
#ifdef TK_USE_INPUT_METHODS
-static int InvokeInputMethods(TkWindow *winPtr, XEvent *eventPtr);
static void CreateXIC(TkWindow *winPtr);
#endif /* TK_USE_INPUT_METHODS */
@@ -379,62 +378,6 @@ CreateXIC(
/*
*----------------------------------------------------------------------
*
- * InvokeInputMethods --
- *
- * Pass the event to the input method(s), if there are any, and discard
- * the event if the input method(s) insist. Create the input context for
- * the window if it hasn't already been done (XFilterEvent needs this
- * context).
- *
- * When the event is a FocusIn event, set the input context focus to the
- * receiving window.
- *
- * Results:
- * 1 when we are done with the event.
- * 0 when the event can be processed further.
- *
- * Side effects:
- * Input contexts/methods may be created.
- *
- *----------------------------------------------------------------------
- */
-
-#ifdef TK_USE_INPUT_METHODS
-static int
-InvokeInputMethods(
- TkWindow *winPtr,
- XEvent *eventPtr)
-{
- TkDisplay *dispPtr = winPtr->dispPtr;
-
- if ((dispPtr->flags & TK_DISPLAY_USE_IM)) {
- if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
- winPtr->flags |= TK_CHECKED_IC;
- if (dispPtr->inputMethod != NULL) {
- CreateXIC(winPtr);
- }
- }
- switch (eventPtr->type) {
- case FocusIn:
- if (winPtr->inputContext != NULL) {
- XSetICFocus(winPtr->inputContext);
- }
- break;
- case KeyPress:
- case KeyRelease:
- if (XFilterEvent(eventPtr, None)) {
- return 1;
- }
- break;
- }
- }
- return 0;
-}
-#endif /*TK_USE_INPUT_METHODS*/
-
-/*
- *----------------------------------------------------------------------
- *
* GetTkWindowFromXEvent --
*
* Attempt to find which TkWindow is associated with an event. If it
@@ -1346,9 +1289,24 @@ Tk_HandleEvent(
}
}
+ /*
+ * Create the input context for the window if it hasn't already been done
+ * (XFilterEvent needs this context). When the event is a FocusIn event,
+ * set the input context focus to the receiving window. This code is only
+ * ever active for X11.
+ */
+
#ifdef TK_USE_INPUT_METHODS
- if (InvokeInputMethods(winPtr, eventPtr)) {
- goto releaseInterpreter;
+ if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) {
+ if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
+ winPtr->flags |= TK_CHECKED_IC;
+ if (winPtr->dispPtr->inputMethod != NULL) {
+ CreateXIC(winPtr);
+ }
+ }
+ if (eventPtr->type == FocusIn && winPtr->inputContext != NULL) {
+ XSetICFocus(winPtr->inputContext);
+ }
}
#endif
diff --git a/generic/tkInt.h b/generic/tkInt.h
index c929f05..9cec9ab 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -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: tkInt.h,v 1.82.2.4 2009/06/27 19:53:16 nijtmans Exp $
+ * RCS: $Id: tkInt.h,v 1.82.2.5 2010/01/01 23:03:42 dkf Exp $
*/
#ifndef _TKINT
@@ -313,8 +313,9 @@ typedef struct TkDisplay {
* multiple applications on the display have
* the focus, this will refer to the innermost
* window in the innermost application. This
- * information isn't used under Unix or
- * Windows, but it's needed on the Mac. */
+ * information isn't used on Windows, but it's
+ * needed on the Mac, and also on X11 when XIM
+ * processing is being done. */
/*
* Information used by tkGC.c only: