#include "../../kernel/focus.h"
#include "../../kernel/dispatch.h"
#include "../../kernel/openbox.h"
+#include "../../kernel/grab.h"
#include "../../kernel/action.h"
#include "tree.h"
#include "keyboard.h"
curpos = NULL;
if (grabbed) {
grabbed = FALSE;
- XUngrabKeyboard(ob_display, CurrentTime);
+ grab_server(FALSE);
}
}
}
/* grab the server here to make sure no key pressed go missed */
- XGrabServer(ob_display);
- XSync(ob_display, FALSE);
+ grab_server(TRUE);
grab_keys(FALSE);
grab_keys(TRUE);
- XUngrabServer(ob_display);
- XFlush(ob_display);
+ grab_server(FALSE);
return TRUE;
}
if (p->first_child != NULL) { /* part of a chain */
/* XXX TIMER */
if (!grabbed) {
- /*grab should never fail because we should have a
- sync grab at this point */
- XGrabKeyboard(ob_display, ob_root, 0,
- GrabModeAsync, GrabModeSync,
- CurrentTime);
+ grab_server(TRUE);
+ grabbed = TRUE;
+ XAllowEvents(ob_display, AsyncKeyboard, CurrentTime);
}
- grabbed = TRUE;
curpos = p;
- XAllowEvents(ob_display, AsyncKeyboard, CurrentTime);
} else {
keyaction_do(&p->action, focus_client);