summaryrefslogtreecommitdiff
path: root/modules/im/ximcp
diff options
context:
space:
mode:
authorTheppitak Karoonboonyanan <thep@linux.thai.net>2009-04-09 11:47:55 +0700
committerJulien Cristau <jcristau@debian.org>2009-04-13 17:26:26 +0100
commite09f0d227fbf95b6252759af9d426efd57686f9f (patch)
treef74ac80ccb0c9a155241d782342ba0902bfc2271 /modules/im/ximcp
parentd108d3c706af3502820b5202564488ea19908b77 (diff)
Thai XIM not filters when NumLock or CapsLock is on
The Thai XIM component in libx11 activated on 'th*' locales normally filters input sequence according to orthographic rules. However, when NumLock/CapsLock is on, this stops working. All sequences are passed through. This is caused by missing masks in _XimThaiFilter(), which normally screens out certain special keys from entering orthographic rules. Unfortunately, this included events with NumLock/CapsLock on. Negating the masks from the check allows the events to be tested by the rules. X.Org Bug 12517 <http://bugs.freedesktop.org/show_bug.cgi?id=12517> Signed-off-by: Theppitak Karoonboonyanan <thep@linux.thai.net> Signed-off-by: Julien Cristau <jcristau@debian.org>
Diffstat (limited to 'modules/im/ximcp')
-rw-r--r--modules/im/ximcp/imThaiFlt.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/im/ximcp/imThaiFlt.c b/modules/im/ximcp/imThaiFlt.c
index 368ea5c..42a30d7 100644
--- a/modules/im/ximcp/imThaiFlt.c
+++ b/modules/im/ximcp/imThaiFlt.c
@@ -1236,6 +1236,22 @@ ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol)
return True;
}
+Private unsigned
+NumLockMask(Display *d)
+{
+ int i;
+ XModifierKeymap *map = XGetModifierMapping (d);
+ KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock);
+ if (numlock_keycode == NoSymbol)
+ return 0;
+
+ for (i = 0; i < 8; i++) {
+ if (map->modifiermap[map->max_keypermod * i] == numlock_keycode)
+ return 1 << i;
+ }
+ return 0;
+}
+
/*
* Filter function for TACTIS
*/
@@ -1267,7 +1283,7 @@ _XimThaiFilter(Display *d, Window w, XEvent *ev, XPointer client_data)
XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]),
&symbol, NULL);
- if ((ev->xkey.state & (AllMods & ~ShiftMask)) ||
+ if ((ev->xkey.state & (AllMods & ~(ShiftMask|LockMask|NumLockMask(d)))) ||
((symbol >> 8 == 0xFF) &&
((XK_BackSpace <= symbol && symbol <= XK_Clear) ||
(symbol == XK_Return) ||