Grab key bindings with GrabModeSync, so that if they lead to a keyboard grab, then no keyboard events will be lost between the initial keybinding and the keyboard grab.

This commit is contained in:
Dana Jansens 2008-02-18 15:55:59 -05:00
parent 58788c7817
commit 5bfa48dcff
2 changed files with 5 additions and 3 deletions

View file

@ -222,7 +222,7 @@ void ungrab_passive_key(void)
{ {
/*ob_debug("ungrabbing %d passive grabs\n", passive_count);*/ /*ob_debug("ungrabbing %d passive grabs\n", passive_count);*/
if (passive_count) { if (passive_count) {
/* kill out passive grab */ /* kill our passive grab */
XUngrabKeyboard(ob_display, event_curtime); XUngrabKeyboard(ob_display, event_curtime);
passive_count = 0; passive_count = 0;
} }

View file

@ -53,13 +53,13 @@ static void grab_keys(gboolean grab)
while (p) { while (p) {
if (p->key) if (p->key)
grab_key(p->key, p->state, RootWindow(ob_display, ob_screen), grab_key(p->key, p->state, RootWindow(ob_display, ob_screen),
GrabModeAsync); GrabModeSync);
p = p->next_sibling; p = p->next_sibling;
} }
if (curpos) if (curpos)
grab_key(config_keyboard_reset_keycode, grab_key(config_keyboard_reset_keycode,
config_keyboard_reset_state, config_keyboard_reset_state,
RootWindow(ob_display, ob_screen), GrabModeAsync); RootWindow(ob_display, ob_screen), GrabModeSync);
} }
} }
@ -263,6 +263,8 @@ void keyboard_event(ObClient *client, const XEvent *e)
} }
p = p->next_sibling; p = p->next_sibling;
} }
XAllowEvents(ob_display, AsyncKeyboard, event_curtime);
} }
static void node_rebind(KeyBindingTree *node) static void node_rebind(KeyBindingTree *node)