summaryrefslogtreecommitdiff
path: root/openbox/screen.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-23 18:21:45 +0000
committerDana Jansens <danakj@orodu.net>2003-03-23 18:21:45 +0000
commitd1de946a62c73634ae86384f9f33b2dd2fce4941 (patch)
treef187bcbe21d61910ef968911c9f50a4b82ddd73d /openbox/screen.c
parentb2c508d97e93e638c824630715b54363d9ca6176 (diff)
move windows when the number of desktops changes and they arent on a desktop anymore
Diffstat (limited to 'openbox/screen.c')
-rw-r--r--openbox/screen.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/openbox/screen.c b/openbox/screen.c
index 82e51f4b..5c0f255f 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -153,7 +153,9 @@ void screen_startup()
/* get the initial size */
screen_resize();
+ screen_num_desktops = 0;
screen_set_num_desktops(4);
+ screen_desktop = 0;
screen_set_desktop(0);
/* don't start in showing-desktop mode */
@@ -206,27 +208,9 @@ void screen_set_num_desktops(guint num)
{
guint i, old;
gulong *viewport;
-
+ GSList *it;
+
g_assert(num > 0);
-
- /* move windows on desktops that will no longer exist! */
- /* XXX
- std::list<Client*>::iterator it, end = clients.end();
- for (it = clients.begin(); it != end; ++it) {
- unsigned int d = (*it)->desktop();
- if (d >= num && d != 0xffffffff) {
- XEvent ce;
- ce.xclient.type = ClientMessage;
- ce.xclient.message_type = otk::Property::atoms.net_wm_desktop;
- ce.xclient.display = **otk::display;
- ce.xclient.window = (*it)->window();
- ce.xclient.format = 32;
- ce.xclient.data.l[0] = num - 1;
- XSendEvent(**otk::display, _info->rootWindow(), false,
- SubstructureNotifyMask | SubstructureRedirectMask, &ce);
- }
- }
- */
old = screen_num_desktops;
screen_num_desktops = num;
@@ -256,6 +240,13 @@ void screen_set_num_desktops(guint num)
for (i = old; i < num; ++i)
focus_order[i] = NULL;
+ /* move windows on desktops that will no longer exist! */
+ for (it = client_list; it != NULL; it = it->next) {
+ Client *c = it->data;
+ if (c->desktop >= num)
+ client_set_desktop(num - 1);
+ }
+
dispatch_ob(Event_Ob_NumDesktops, num, old);
/* change our desktop if we're on one that no longer exists! */