From a2a615810ab64a80f4a219b74ece068ca8a5df4b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 16 Oct 2011 11:10:14 -0400 Subject: [PATCH] Don't make desktop switching interactive when no mods used. (bug #5203) Make mod state passing more consistent, and always give actions the full state instead of stripping sometimes. (They ended up expecting it stripped always). --- openbox/action.c | 2 +- openbox/actions/cyclewindows.c | 7 ++++--- openbox/actions/desktop.c | 9 +++++---- openbox/actions/directionalwindows.c | 7 ++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/openbox/action.c b/openbox/action.c index b2b2b039..8c07470f 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -343,7 +343,7 @@ static gboolean action_interactive_begin_act(ObAction *act, guint state) current_i_act = act; action_ref(current_i_act); - current_i_initial_state = obt_keyboard_only_modmasks(state); + current_i_initial_state = state; /* if using focus_delay, stop the timer now so that focus doesn't go moving on us, which would kill the action */ diff --git a/openbox/actions/cyclewindows.c b/openbox/actions/cyclewindows.c index 17599975..0c37a2bf 100644 --- a/openbox/actions/cyclewindows.c +++ b/openbox/actions/cyclewindows.c @@ -182,8 +182,9 @@ static gboolean i_input_func(guint initial_state, gboolean *used) { Options *o = options; - guint mods; + guint mods, init; + init = obt_keyboard_only_modmasks(initial_state); mods = obt_keyboard_only_modmasks(e->xkey.state); if (e->type == KeyRelease) { /* remove from the state the mask of the modifier key being @@ -202,14 +203,14 @@ static gboolean i_input_func(guint initial_state, } /* There were no modifiers and they pressed enter */ - else if ((sym == XK_Return || sym == XK_KP_Enter) && !initial_state) { + else if ((sym == XK_Return || sym == XK_KP_Enter) && !init) { o->cancel = FALSE; o->state = e->xkey.state; return FALSE; } } /* They released the modifiers */ - else if (e->type == KeyRelease && initial_state && !(mods & initial_state)) + else if (e->type == KeyRelease && init && !(mods & init)) { o->cancel = FALSE; o->state = e->xkey.state; diff --git a/openbox/actions/desktop.c b/openbox/actions/desktop.c index a5d231fe..d1da75a5 100644 --- a/openbox/actions/desktop.c +++ b/openbox/actions/desktop.c @@ -255,8 +255,9 @@ static gboolean i_input_func(guint initial_state, gpointer options, gboolean *used) { - guint mods; + guint mods, init; + init = obt_keyboard_only_modmasks(initial_state); mods = obt_keyboard_only_modmasks(e->xkey.state); if (e->type == KeyRelease) { /* remove from the state the mask of the modifier key being @@ -272,11 +273,11 @@ static gboolean i_input_func(guint initial_state, return FALSE; /* There were no modifiers and they pressed enter */ - else if ((sym == XK_Return || sym == XK_KP_Enter) && !initial_state) + else if ((sym == XK_Return || sym == XK_KP_Enter) && !init) return FALSE; } /* They released the modifiers */ - else if (e->type == KeyRelease && initial_state && !(mods & initial_state)) + else if (e->type == KeyRelease && initial_state && !(mods & init)) { return FALSE; } @@ -286,7 +287,7 @@ static gboolean i_input_func(guint initial_state, static gboolean i_pre_func(guint initial_state, gpointer options) { - if (!initial_state) { + if (!obt_keyboard_only_modmasks(initial_state)) { Options *o = options; o->interactive = FALSE; return FALSE; diff --git a/openbox/actions/directionalwindows.c b/openbox/actions/directionalwindows.c index 54872cdf..39cb0c14 100644 --- a/openbox/actions/directionalwindows.c +++ b/openbox/actions/directionalwindows.c @@ -182,8 +182,9 @@ static gboolean i_input_func(guint initial_state, gpointer options, gboolean *used) { - guint mods; + guint mods, init; + init = obt_keyboard_only_modmasks(initial_state); mods = obt_keyboard_only_modmasks(e->xkey.state); if (e->type == KeyRelease) { /* remove from the state the mask of the modifier key being @@ -201,13 +202,13 @@ static gboolean i_input_func(guint initial_state, } /* There were no modifiers and they pressed enter */ - else if ((sym == XK_Return || sym == XK_KP_Enter) && !initial_state) { + else if ((sym == XK_Return || sym == XK_KP_Enter) && !init) { end_cycle(FALSE, e->xkey.state, options); return FALSE; } } /* They released the modifiers */ - else if (e->type == KeyRelease && initial_state && !(mods & initial_state)) + else if (e->type == KeyRelease && init && !(mods & init)) { end_cycle(FALSE, e->xkey.state, options); return FALSE; -- 2.34.1