summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2008-01-11 13:05:11 -0500
committerDana Jansens <danakj@orodu.net>2008-01-11 13:05:11 -0500
commit162a97e158e0dfa774754aee5198786907f9453b (patch)
tree7b253460a9c8e348a1d3e2406dd6f5a42d666d59 /openbox
parent5a468756c07a43e0ee7fa4e406847c86db09834a (diff)
XKB modifiers are strange things, and i don't know how to read them properly in modkeys.c and convert it all to the x core stuff. so we use this to get the state of the modifiers, otherwise we end up missing them sometimes (like on PPC)
Diffstat (limited to 'openbox')
-rw-r--r--openbox/event.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/openbox/event.c b/openbox/event.c
index 41bcd350..0c97bd93 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -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);