X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=928c1ef62c6d8c3180f8f64050a03be949fec845;hb=3443454f33f88e10f187b78594ecfb5c09e1448d;hp=e9d0ce1a67d1e06f211083e059561dd95e1ea6f7;hpb=a822cbe13b18eca60b220b9b312210c02b946a3b;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index e9d0ce1a..928c1ef6 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::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(c, num - 1); + } + dispatch_ob(Event_Ob_NumDesktops, num, old); /* change our desktop if we're on one that no longer exists! */ @@ -432,7 +423,7 @@ void screen_update_struts() g_free(strut); strut = g_new0(Strut, screen_num_desktops + 1); - for (it = client_list; it; it = it->next) { + for (it = client_list; it != NULL; it = it->next) { Client *c = it->data; if (c->iconic) continue; /* these dont count in the strut */