+ guint i;
+
+ xerror_set_ignore(TRUE); /* can get BadAccess' from these */
+ xerror_occured = FALSE;
+ for (i = 0; i < MASK_LIST_SIZE; ++i)
+ XGrabButton(ob_display, button, state | mask_list[i], win, FALSE, mask,
+ pointer_mode, GrabModeSync, None, ob_cursor(cur));
+ xerror_set_ignore(FALSE);
+ if (xerror_occured)
+ g_warning("failed to grab button %d modifiers %d", button, state);
+}
+
+void grab_button(guint button, guint state, Window win, guint mask)
+{
+ grab_button_full(button, state, win, mask, GrabModeAsync, OB_CURSOR_NONE);
+}
+
+void ungrab_button(guint button, guint state, Window win)
+{
+ guint i;
+
+ for (i = 0; i < MASK_LIST_SIZE; ++i)
+ XUngrabButton(ob_display, button, state | mask_list[i], win);
+}
+
+void grab_key(guint keycode, guint state, Window win, gint keyboard_mode)
+{
+ guint i;
+
+ xerror_set_ignore(TRUE); /* can get BadAccess' from these */
+ xerror_occured = FALSE;
+ for (i = 0; i < MASK_LIST_SIZE; ++i)
+ XGrabKey(ob_display, keycode, state | mask_list[i], win, FALSE,
+ GrabModeAsync, keyboard_mode);
+ xerror_set_ignore(FALSE);
+ if (xerror_occured)
+ g_warning("failed to grab keycode %d modifiers %d", keycode, state);