playing a bit with grabs
make mouse clicks cancel alt-tab and stuff if you arent dragging during the alt-tab
This commit is contained in:
parent
05560c929b
commit
c8983c42a7
3 changed files with 10 additions and 10 deletions
|
@ -166,18 +166,13 @@ void grab_button_full(guint button, guint state, Window win, guint mask,
|
||||||
xerror_set_ignore(TRUE); /* can get BadAccess from these */
|
xerror_set_ignore(TRUE); /* can get BadAccess from these */
|
||||||
xerror_occured = FALSE;
|
xerror_occured = FALSE;
|
||||||
for (i = 0; i < MASK_LIST_SIZE; ++i)
|
for (i = 0; i < MASK_LIST_SIZE; ++i)
|
||||||
XGrabButton(ob_display, button, state | mask_list[i], win, FALSE, mask,
|
XGrabButton(ob_display, button, state | mask_list[i], win, False, mask,
|
||||||
pointer_mode, GrabModeSync, None, ob_cursor(cur));
|
pointer_mode, GrabModeAsync, None, ob_cursor(cur));
|
||||||
xerror_set_ignore(FALSE);
|
xerror_set_ignore(FALSE);
|
||||||
if (xerror_occured)
|
if (xerror_occured)
|
||||||
ob_debug("Failed to grab button %d modifiers %d", button, state);
|
ob_debug("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)
|
void ungrab_button(guint button, guint state, Window win)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
|
@ -34,7 +34,6 @@ gint grab_server(gboolean grab);
|
||||||
gboolean grab_on_keyboard();
|
gboolean grab_on_keyboard();
|
||||||
gboolean grab_on_pointer();
|
gboolean grab_on_pointer();
|
||||||
|
|
||||||
void grab_button(guint button, guint state, Window win, guint mask);
|
|
||||||
void grab_button_full(guint button, guint state, Window win, guint mask,
|
void grab_button_full(guint button, guint state, Window win, guint mask,
|
||||||
gint pointer_mode, ObCursor cursor);
|
gint pointer_mode, ObCursor cursor);
|
||||||
void ungrab_button(guint button, guint state, Window win);
|
void ungrab_button(guint button, guint state, Window win);
|
||||||
|
|
|
@ -159,8 +159,11 @@ gboolean keyboard_interactive_grab(guint state, ObClient *client,
|
||||||
g_assert(action->data.any.interactive);
|
g_assert(action->data.any.interactive);
|
||||||
|
|
||||||
if (!interactive_states) {
|
if (!interactive_states) {
|
||||||
if (!grab_keyboard(TRUE))
|
grab_pointer(TRUE, FALSE, OB_CURSOR_POINTER);
|
||||||
|
if (!grab_keyboard(TRUE)) {
|
||||||
|
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s = g_new(ObInteractiveState, 1);
|
s = g_new(ObInteractiveState, 1);
|
||||||
|
@ -186,6 +189,7 @@ void keyboard_interactive_end(ObInteractiveState *s,
|
||||||
|
|
||||||
if (!interactive_states) {
|
if (!interactive_states) {
|
||||||
grab_keyboard(FALSE);
|
grab_keyboard(FALSE);
|
||||||
|
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
|
||||||
keyboard_reset_chains();
|
keyboard_reset_chains();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +228,9 @@ gboolean keyboard_process_interactive_grab(const XEvent *e, ObClient **client)
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
else */if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
|
else */if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
|
||||||
cancel = done = TRUE;
|
cancel = done = TRUE;
|
||||||
}
|
} else if (e->type == ButtonPress)
|
||||||
|
cancel = done = TRUE;
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
keyboard_interactive_end(s, e->xkey.state, cancel, e->xkey.time);
|
keyboard_interactive_end(s, e->xkey.state, cancel, e->xkey.time);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue