]> Dogcows Code - chaz/openbox/commitdiff
make the Desktop action an interactive one
authorDana Jansens <danakj@orodu.net>
Fri, 26 Sep 2003 07:41:32 +0000 (07:41 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 26 Sep 2003 07:41:32 +0000 (07:41 +0000)
openbox/action.c
openbox/action.h

index d25014443581ecd111db25b33b0e04b4d8088a3e..bef8768039d80488527029dfc92fcd833a0f008e 100644 (file)
@@ -201,6 +201,11 @@ void setup_action_send_to_desktop_down(ObAction **a, ObUserAction uact)
     (*a)->data.sendtodir.follow = TRUE;
 }
 
+void setup_action_desktop(ObAction **a, ObUserAction uact)
+{
+    (*a)->data.desktop.inter.any.interactive = TRUE;
+}
+
 void setup_action_desktop_prev(ObAction **a, ObUserAction uact)
 {
     (*a)->data.desktopdir.inter.any.interactive = TRUE;
@@ -589,7 +594,7 @@ ActionString actionstrings[] =
     {
         "desktop",
         action_desktop,
-        NULL
+        setup_action_desktop
     },
     {
         "desktopnext",
@@ -770,7 +775,9 @@ ObAction *action_from_string(const gchar *name, ObUserAction uact)
             a = action_new(actionstrings[i].func, uact);
             if (actionstrings[i].setup)
                 actionstrings[i].setup(&a, uact);
-            /* only key bindings can be interactive. thus saith the xor. */
+            /* only key bindings can be interactive. thus saith the xor.
+             because of how the mouse is grabbed, mouse events dont even get
+             read during interactive events, so no dice! >:) */
             if (uact != OB_USER_ACTION_KEYBOARD_KEY)
                 a->data.any.interactive = FALSE;
             break;
@@ -1162,9 +1169,29 @@ void action_send_to_desktop(union ActionData *data)
 
 void action_desktop(union ActionData *data)
 {
-    if (data->desktop.desk < screen_num_desktops ||
-        data->desktop.desk == DESKTOP_ALL)
-        screen_set_desktop(data->desktop.desk);
+    static guint first = (unsigned) -1;
+
+    if (data->inter.any.interactive && first == (unsigned) -1)
+        first = screen_desktop;
+
+    if (!data->inter.any.interactive ||
+        (!data->inter.cancel && !data->inter.final))
+    {
+        if (data->desktop.desk < screen_num_desktops ||
+            data->desktop.desk == DESKTOP_ALL)
+        {
+            screen_set_desktop(data->desktop.desk);
+            if (data->inter.any.interactive)
+                screen_desktop_popup(data->desktop.desk, TRUE);
+        }
+    } else if (data->inter.cancel) {
+        screen_set_desktop(first);
+    }
+
+    if (data->inter.any.interactive && data->inter.final) {
+        screen_desktop_popup(0, FALSE);
+        first = (unsigned) -1;
+    }
 }
 
 void action_desktop_dir(union ActionData *data)
index 99983ee19fd61987513d0faef9be8fdc6623b07a..3edc96b90f7bbf04ae5998c12c064a4264921096 100644 (file)
@@ -99,7 +99,7 @@ struct SendToDesktopDirection {
 };
 
 struct Desktop {
-    struct AnyAction any;
+    struct InteractiveAction inter;
     guint desk;
 };
 
This page took 0.029161 seconds and 4 git commands to generate.