don't die when someone else has a key grabbed
This commit is contained in:
parent
a61cecfe3a
commit
475fb805f2
1 changed files with 6 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "openbox.h"
|
#include "openbox.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "xerror.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
@ -102,9 +103,14 @@ void grab_key(guint keycode, guint state, int keyboard_mode)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
xerror_set_ignore(TRUE); /* can get BadAccess' from these */
|
||||||
|
xerror_occured = FALSE;
|
||||||
for (i = 0; i < MASK_LIST_SIZE; ++i)
|
for (i = 0; i < MASK_LIST_SIZE; ++i)
|
||||||
XGrabKey(ob_display, keycode, state | mask_list[i], ob_root, FALSE,
|
XGrabKey(ob_display, keycode, state | mask_list[i], ob_root, FALSE,
|
||||||
GrabModeAsync, keyboard_mode);
|
GrabModeAsync, keyboard_mode);
|
||||||
|
xerror_set_ignore(FALSE);
|
||||||
|
if (xerror_occured)
|
||||||
|
g_warning("failed to grab keycode %d modifiers %d", keycode, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ungrab_all_keys()
|
void ungrab_all_keys()
|
||||||
|
|
Loading…
Reference in a new issue