Don't make desktop switching interactive when no mods used. (bug #5203)
authorDana Jansens <danakj@orodu.net>
Sun, 16 Oct 2011 15:10:14 +0000 (11:10 -0400)
committerDana Jansens <danakj@orodu.net>
Sun, 16 Oct 2011 22:58:21 +0000 (18:58 -0400)
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
openbox/actions/cyclewindows.c
openbox/actions/desktop.c
openbox/actions/directionalwindows.c

index b2b2b0390f318bdebd5dbdab6fb9b39e482a492c..8c07470f685b6b447c249dc02f86b0551444ffa0 100644 (file)
@@ -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 */
index 17599975ac939ee92ec6fdac71e2e5c17aadd6b4..0c37a2bf790b79413b888edf13e27ff3c533e645 100644 (file)
@@ -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;
index a5d231fe92798f7619dd989029823f4c641b6792..d1da75a5ae39de89b39c2df3f4bf2a77738a4e9c 100644 (file)
@@ -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;
index 54872cdff81a880b0575bf791ef3991aeeee781e..39cb0c147f9c765978b998cf7c82a0a9df3b3ca2 100644 (file)
@@ -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;