]> Dogcows Code - chaz/openbox/blobdiff - openbox/event.c
i learnt what xkb does with the state.
[chaz/openbox] / openbox / event.c
index 51cfc658c638a9db5128f4fd3a70d71216715acd..bd33b489e7aa7055f3337ff403532f5001c4d9bb 100644 (file)
@@ -260,10 +260,6 @@ 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:
@@ -274,20 +270,14 @@ static void event_hack_mods(XEvent *e)
         break;
     case KeyRelease:
 #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(obt_display, XkbUseCoreKbd, &xkb_state) == Success)
-            e->xkey.state =
-                obt_keyboard_only_modmasks(xkb_state.compat_state);
-        else
+        /* keep only the keyboard modifiers.  xkb includes other things here.
+           (see XKBProto.pdf document: section 2.2.2) */
+        e->xkey.state &= 0xf;
 #endif
-        {
-            e->xkey.state = obt_keyboard_only_modmasks(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 &= ~obt_keyboard_keycode_to_modmask(e->xkey.keycode);
-        }
+        e->xkey.state = obt_keyboard_only_modmasks(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 &= ~obt_keyboard_keycode_to_modmask(e->xkey.keycode);
         break;
     case MotionNotify:
         e->xmotion.state = obt_keyboard_only_modmasks(e->xmotion.state);
This page took 0.026237 seconds and 4 git commands to generate.