summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixEvent.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-01-01 22:50:26 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-01-01 22:50:26 (GMT)
commit1a86dacbaaea58d12f5c210efdd06d8974adc362 (patch)
tree2acdd461994a57bdc0d886e6e24d27cc14d317af /unix/tkUnixEvent.c
parent3147e53de56d78b75db674135ff4782d49467c73 (diff)
downloadtk-1a86dacbaaea58d12f5c210efdd06d8974adc362.zip
tk-1a86dacbaaea58d12f5c210efdd06d8974adc362.tar.gz
tk-1a86dacbaaea58d12f5c210efdd06d8974adc362.tar.bz2
[Bug 1924761]: Consolidate calls to XFilterEvent to make input methods work.
Diffstat (limited to 'unix/tkUnixEvent.c')
-rw-r--r--unix/tkUnixEvent.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index d572d42..39e3e5e 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.32 2009/12/16 21:12:25 nijtmans Exp $
+ * RCS: @(#) $Id: tkUnixEvent.c,v 1.33 2010/01/01 22:50:27 dkf Exp $
*/
#include "tkUnixInt.h"
@@ -282,12 +282,17 @@ TransferXEventsToTcl(
xGenericEvent xge;
#endif
} event;
+ Window w;
/*
* 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.
+ * event filtering. KeyPress and KeyRelease events need special treatment
+ * so that they get directed according to Tk's focus rules during XIM
+ * handling. Theoretically they can go to the wrong place still (if
+ * there's a focus change in the queue) but if we push the handling off
+ * until Tk_HandleEvent then many input methods actually cease to work
+ * correctly. Most of the time, Tk processes its event queue fast enough
+ * for this to not be an issue anyway. [Bug 1924761]
*/
while (QLength(display) > 0) {
@@ -298,11 +303,24 @@ TransferXEventsToTcl(
event.xge.extension, event.xge.evtype);
}
#endif
- if (event.x.type != KeyPress && event.x.type != KeyRelease) {
- if (XFilterEvent(&event.x, None)) {
- continue;
+ w = None;
+ if (event.x.type == KeyPress || event.x.type == KeyRelease) {
+ TkDisplay *dispPtr;
+
+ for (dispPtr = TkGetDisplayList(); ; dispPtr = dispPtr->nextPtr) {
+ if (dispPtr == NULL) {
+ break;
+ } else if (dispPtr->display == event.x.xany.display) {
+ if (dispPtr->focusPtr != NULL) {
+ w = dispPtr->focusPtr->window;
+ }
+ break;
+ }
}
}
+ if (XFilterEvent(&event.x, w)) {
+ continue;
+ }
Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
}
}