use the grab_server function

This commit is contained in:
Dana Jansens 2003-03-18 20:01:04 +00:00
parent 7d215bd255
commit 838f76cd21

View file

@ -1,6 +1,7 @@
#include "../../kernel/focus.h" #include "../../kernel/focus.h"
#include "../../kernel/dispatch.h" #include "../../kernel/dispatch.h"
#include "../../kernel/openbox.h" #include "../../kernel/openbox.h"
#include "../../kernel/grab.h"
#include "../../kernel/action.h" #include "../../kernel/action.h"
#include "tree.h" #include "tree.h"
#include "keyboard.h" #include "keyboard.h"
@ -33,7 +34,7 @@ static void reset_chains()
curpos = NULL; curpos = NULL;
if (grabbed) { if (grabbed) {
grabbed = FALSE; grabbed = FALSE;
XUngrabKeyboard(ob_display, CurrentTime); grab_server(FALSE);
} }
} }
@ -69,8 +70,7 @@ static gboolean bind(GList *keylist, KeyAction *action)
} }
/* grab the server here to make sure no key pressed go missed */ /* grab the server here to make sure no key pressed go missed */
XGrabServer(ob_display); grab_server(TRUE);
XSync(ob_display, FALSE);
grab_keys(FALSE); grab_keys(FALSE);
@ -88,8 +88,7 @@ static gboolean bind(GList *keylist, KeyAction *action)
grab_keys(TRUE); grab_keys(TRUE);
XUngrabServer(ob_display); grab_server(FALSE);
XFlush(ob_display);
return TRUE; return TRUE;
} }
@ -112,15 +111,11 @@ static void press(ObEvent *e, void *foo)
if (p->first_child != NULL) { /* part of a chain */ if (p->first_child != NULL) { /* part of a chain */
/* XXX TIMER */ /* XXX TIMER */
if (!grabbed) { if (!grabbed) {
/*grab should never fail because we should have a grab_server(TRUE);
sync grab at this point */
XGrabKeyboard(ob_display, ob_root, 0,
GrabModeAsync, GrabModeSync,
CurrentTime);
}
grabbed = TRUE; grabbed = TRUE;
curpos = p;
XAllowEvents(ob_display, AsyncKeyboard, CurrentTime); XAllowEvents(ob_display, AsyncKeyboard, CurrentTime);
}
curpos = p;
} else { } else {
keyaction_do(&p->action, focus_client); keyaction_do(&p->action, focus_client);