]> Dogcows Code - chaz/openbox/commitdiff
add AddDesktopLast RemoveDesktopLast AddDesktopCurrent RemoveDesktopCurrent
authorDana Jansens <danakj@orodu.net>
Wed, 13 Jun 2007 15:01:27 +0000 (15:01 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 13 Jun 2007 15:01:27 +0000 (15:01 +0000)
openbox/action.c
openbox/action.h

index 6ba52c8959f13d140fbea9a3f5f0e1a7ae3adb08..52b1de3da18bc4ace02f1c895984786d5cbeb735 100644 (file)
@@ -470,6 +470,16 @@ void setup_action_showmenu(ObAction **a, ObUserAction uact)
     }
 }
 
+void setup_action_addremove_desktop_current(ObAction **a, ObUserAction uact)
+{
+    (*a)->data.addremovedesktop.current = TRUE;
+}
+
+void setup_action_addremove_desktop_last(ObAction **a, ObUserAction uact)
+{
+    (*a)->data.addremovedesktop.current = FALSE;
+}
+
 void setup_action_focus(ObAction **a, ObUserAction uact)
 {
     (*a)->data.any.client_action = OB_CLIENT_ACTION_OPTIONAL;
@@ -927,6 +937,26 @@ ActionString actionstrings[] =
         action_break_chroot,
         NULL
     },
+    {
+        "adddesktoplast",
+        action_add_desktop,
+        setup_action_addremove_desktop_last
+    },
+    {
+        "removedesktoplast",
+        action_remove_desktop,
+        setup_action_addremove_desktop_last
+    },
+    {
+        "adddesktopcurrent",
+        action_add_desktop,
+        setup_action_addremove_desktop_current
+    },
+    {
+        "removedesktopcurrent",
+        action_remove_desktop,
+        setup_action_addremove_desktop_current
+    },
     {
         NULL,
         NULL,
@@ -2003,3 +2033,37 @@ void action_break_chroot(union ActionData *data)
     /* break out of one chroot */
     keyboard_reset_chains(1);
 }
+
+void action_add_desktop(union ActionData *data)
+{
+    screen_set_num_desktops(screen_num_desktops+1);
+
+    /* move all the clients over */
+    if (data->addremovedesktop.current) {
+        GList *it;
+
+        for (it = client_list; it; it = g_list_next(it)) {
+            ObClient *c = it->data;
+            if (c->desktop != DESKTOP_ALL && c->desktop >= screen_desktop)
+                client_set_desktop(c, c->desktop+1, FALSE);
+        }
+    }
+}
+
+void action_remove_desktop(union ActionData *data)
+{
+    if (screen_num_desktops < 2) return;
+
+    /* move all the clients over */
+    if (data->addremovedesktop.current) {
+        GList *it;
+
+        for (it = client_list; it; it = g_list_next(it)) {
+            ObClient *c = it->data;
+            if (c->desktop != DESKTOP_ALL && c->desktop > screen_desktop)
+                client_set_desktop(c, c->desktop-1, FALSE);
+        }
+    }
+
+    screen_set_num_desktops(screen_num_desktops-1);
+}
index 38452e44081747b0b984432a134df992e9ac0a26..17e35766a640d336f2d5b44abe2f1674a5f1aba1 100644 (file)
@@ -142,6 +142,11 @@ struct ShowMenu {
     gchar *name;
 };
 
+struct AddRemoveDesktop {
+    struct AnyAction any;
+    gboolean current;
+};
+
 struct CycleWindows {
     struct InteractiveAction inter;
     gboolean linear;
@@ -175,6 +180,7 @@ union ActionData {
     struct CycleWindows cycle;
     struct Layer layer;
     struct Stacking stacking;
+    struct AddRemoveDesktop addremovedesktop;
 };
 
 struct _ObAction {
@@ -356,5 +362,9 @@ void action_show_desktop(union ActionData *data);
 void action_unshow_desktop(union ActionData *data);
 /* Any */
 void action_break_chroot(union ActionData *data);
+/* AddRemoveDesktop */
+void action_add_desktop(union ActionData *data);
+/* AddRemoveDesktop */
+void action_remove_desktop(union ActionData *data);
 
 #endif
This page took 0.025541 seconds and 4 git commands to generate.