X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=506287303e3af6137430cf860bf529595d0ca813;hb=c473d5f80ac8a92ba4046365769b2b84ed72881d;hp=01cca6539536d467ee5397cc9c59a3681c5acbee;hpb=d4601cd0348caa9fdb7643a99f025dddbe5a34c9;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 01cca653..50628730 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! */ @@ -270,8 +261,6 @@ void screen_set_desktop(guint num) g_assert(num < screen_num_desktops); - g_message("Moving to desktop %u", num); - old = screen_desktop; screen_desktop = num; PROP_SET32(ob_root, net_current_desktop, cardinal, num); @@ -377,24 +366,16 @@ void screen_update_desktop_names() void screen_show_desktop(gboolean show) { GList *it; - static Window saved_focus = 0; if (show == screen_showing_desktop) return; /* no change */ - /* save the window focus, and restore it when leaving the show-desktop - mode */ - if (show && focus_client) - saved_focus = focus_client->window; - screen_showing_desktop = show; if (show) { /* bottom to top */ for (it = g_list_last(stacking_list); it != NULL; it = it->prev) { Client *client = it->data; - if (client->type == Type_Desktop) - client_focus(client); - else if (client->frame->visible && !client_should_show(client)) + if (client->frame->visible && !client_should_show(client)) engine_frame_hide(client->frame); } } else { @@ -406,15 +387,6 @@ void screen_show_desktop(gboolean show) } } - if (!show) { - Client *f = focus_client; - if (!f || f->type == Type_Desktop) { - Client *c = g_hash_table_lookup(client_map, - (gpointer)saved_focus); - if (c) client_focus(c); - } - } - show = !!show; /* make it boolean */ PROP_SET32(ob_root, net_showing_desktop, cardinal, show); @@ -449,7 +421,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 */