summaryrefslogtreecommitdiff
path: root/openbox/actions/addremovedesktop.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-06-23 16:15:46 +0000
committerDana Jansens <danakj@orodu.net>2007-06-23 16:15:46 +0000
commit8bcd349e4e7078e663d3092a6ad6c7aff8eb05a0 (patch)
tree7d076aa3273aef8460ff3499bd03526a1fc1e63e /openbox/actions/addremovedesktop.c
parentb1a50affe5bc968bffaac0e87ae108259beed428 (diff)
move logic for add/remove desktop into screen.c
Diffstat (limited to 'openbox/actions/addremovedesktop.c')
-rw-r--r--openbox/actions/addremovedesktop.c66
1 files changed, 4 insertions, 62 deletions
diff --git a/openbox/actions/addremovedesktop.c b/openbox/actions/addremovedesktop.c
index 85aeb3f8..6a646681 100644
--- a/openbox/actions/addremovedesktop.c
+++ b/openbox/actions/addremovedesktop.c
@@ -1,7 +1,5 @@
#include "openbox/actions.h"
#include "openbox/screen.h"
-#include "openbox/client.h"
-#include "openbox/debug.h"
#include <glib.h>
typedef struct {
@@ -78,66 +76,10 @@ static gboolean run_func(ObActionsData *data, gpointer options)
actions_client_move(data, FALSE);
- if (o->add) {
- screen_set_num_desktops(screen_num_desktops+1);
-
- /* move all the clients over */
- if (o->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, TRUE);
- }
- }
- }
- else if (screen_num_desktops > 1) {
- guint rmdesktop, movedesktop;
- GList *it, *stacking_copy;
-
- /* what desktop are we removing and moving to? */
- if (o->current)
- rmdesktop = screen_desktop;
- else
- rmdesktop = screen_num_desktops - 1;
- if (rmdesktop < screen_num_desktops - 1)
- movedesktop = rmdesktop + 1;
- else
- movedesktop = rmdesktop;
-
- /* make a copy of the list cuz we're changing it */
- stacking_copy = g_list_copy(stacking_list);
- for (it = g_list_last(stacking_copy); it; it = g_list_previous(it)) {
- if (WINDOW_IS_CLIENT(it->data)) {
- ObClient *c = it->data;
- guint d = c->desktop;
- if (d != DESKTOP_ALL && d >= movedesktop) {
- client_set_desktop(c, c->desktop - 1, TRUE, TRUE);
- ob_debug("moving window %s\n", c->title);
- }
- /* raise all the windows that are on the current desktop which
- is being merged */
- if ((screen_desktop == rmdesktop - 1 ||
- screen_desktop == rmdesktop) &&
- (d == DESKTOP_ALL || d == screen_desktop))
- {
- stacking_raise(CLIENT_AS_WINDOW(c));
- ob_debug("raising window %s\n", c->title);
- }
- }
- }
-
- /* act like we're changing desktops */
- if (screen_desktop < screen_num_desktops - 1) {
- gint d = screen_desktop;
- screen_desktop = screen_last_desktop;
- screen_set_desktop(d, TRUE);
- ob_debug("fake desktop change\n");
- }
-
- screen_set_num_desktops(screen_num_desktops-1);
- }
+ if (o->add)
+ screen_add_desktop(o->current);
+ else
+ screen_remove_desktop(o->current);
actions_client_move(data, TRUE);