summaryrefslogtreecommitdiff
path: root/openbox/event.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-02-09 21:03:01 -0500
committerDana Jansens <danakj@orodu.net>2010-02-11 11:01:15 -0500
commitc168faee634d3c3f9494b2a4da89b80d10f311ce (patch)
tree8595091ec43cbfd8b6e309182536d11264634b20 /openbox/event.c
parente9070fe7da03effb198c0bbae8293f22fdf36085 (diff)
i learnt what xkb does with the state.
use the state from keyrelease events directly, rather than query the state (which is not as accurate!) the xkb state (as opposed to the normally sent compat state) contains extra info like the keyboard group, the pointer buttons, etc. so we can just strip that stuff out. (See section 2.2.2 of the XKB proto document)
Diffstat (limited to 'openbox/event.c')
-rw-r--r--openbox/event.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/openbox/event.c b/openbox/event.c
index 51cfc658..bd33b489 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -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);