]> Dogcows Code - chaz/openbox/commitdiff
XKB modifiers are strange things, and i don't know how to read them properly in modke...
authorDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 18:05:11 +0000 (13:05 -0500)
committerDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 18:05:11 +0000 (13:05 -0500)
openbox/event.c

index 41bcd350b3b9cfd01fba02dda297b06546f62c45..0c97bd9388461585b98d98236b69bd17df9085d2 100644 (file)
@@ -247,6 +247,10 @@ static void event_set_curtime(XEvent *e)
 
 static void event_hack_mods(XEvent *e)
 {
+#ifdef XKB
+    XkbStateRec xkb_state;
+#endif
+
     switch (e->type) {
     case ButtonPress:
     case ButtonRelease:
@@ -256,10 +260,22 @@ static void event_hack_mods(XEvent *e)
         e->xkey.state = modkeys_only_modifier_masks(e->xkey.state);
         break;
     case KeyRelease:
-        e->xkey.state = modkeys_only_modifier_masks(e->xkey.state);
-        /* remove from the state the mask of the modifier key being released,
-           if it is a modifier key being released that is */
-        e->xkey.state &= ~modkeys_keycode_to_mask(e->xkey.keycode);
+#ifdef XKB
+        /* If XKB is present, then the modifiers are all strange from its
+           magic.  Our X core protocol stuff won't work, so we use this to
+           find what the modifier state is instead. */
+        if (XkbGetState(ob_display, XkbUseCoreKbd, &xkb_state) == Success) {
+            e->xkey.state = xkb_state.compat_state;
+            break;
+        }
+        else
+#endif
+        {
+            e->xkey.state = modkeys_only_modifier_masks(e->xkey.state);
+            /* remove from the state the mask of the modifier key being
+               released, if it is a modifier key being released that is */
+            e->xkey.state &= ~modkeys_keycode_to_mask(e->xkey.keycode);
+        }
         break;
     case MotionNotify:
         e->xmotion.state = modkeys_only_modifier_masks(e->xmotion.state);
This page took 0.024034 seconds and 4 git commands to generate.