X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=9f14ea8cb68f735d3952005920986be890fb2b8f;hb=58ebc8f73cea0fc74d01cb0336dbb41d88cd5938;hp=506287303e3af6137430cf860bf529595d0ca813;hpb=7c6c4984b39b3e107c1a1f8de88008e0218ea805;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 50628730..9f14ea8c 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1,9 +1,9 @@ #include "openbox.h" #include "prop.h" +#include "config.h" #include "screen.h" #include "client.h" #include "frame.h" -#include "engine.h" #include "focus.h" #include "dispatch.h" #include "../render/render.h" @@ -148,13 +148,23 @@ gboolean screen_annex() void screen_startup() { + GSList *it; + screen_desktop_names = g_ptr_array_new(); /* get the initial size */ screen_resize(); + /* set the names */ + for (it = config_desktops_names; it; it = it->next) + g_ptr_array_add(screen_desktop_names, it->data); /* dont strdup */ + PROP_SETSA(ob_root, net_desktop_names, utf8, screen_desktop_names); + g_ptr_array_set_size(screen_desktop_names, 0); /* rm the ptrs so they dont + get frees when we + update the desktop + names */ screen_num_desktops = 0; - screen_set_num_desktops(4); + screen_set_num_desktops(config_desktops_num); screen_desktop = 0; screen_set_desktop(0); @@ -208,7 +218,7 @@ void screen_set_num_desktops(guint num) { guint i, old; gulong *viewport; - GSList *it; + GList *it; g_assert(num > 0); @@ -244,7 +254,7 @@ void screen_set_num_desktops(guint num) for (it = client_list; it != NULL; it = it->next) { Client *c = it->data; if (c->desktop >= num) - client_set_desktop(c, num - 1); + client_set_desktop(c, num - 1, FALSE); } dispatch_ob(Event_Ob_NumDesktops, num, old); @@ -258,6 +268,7 @@ void screen_set_desktop(guint num) { GList *it; guint old; + XEvent e; g_assert(num < screen_num_desktops); @@ -267,22 +278,30 @@ void screen_set_desktop(guint num) if (old == num) return; + g_message("Moving to desktop %d", num+1); + /* show windows before hiding the rest to lessen the enter/leave events */ /* show windows from top to bottom */ for (it = stacking_list; it != NULL; it = it->next) { Client *c = it->data; if (!c->frame->visible && client_should_show(c)) - engine_frame_show(c->frame); + frame_show(c->frame); } /* hide windows from bottom to top */ for (it = g_list_last(stacking_list); it != NULL; it = it->prev) { Client *c = it->data; if (c->frame->visible && !client_should_show(c)) - engine_frame_hide(c->frame); + frame_hide(c->frame); } + /* focus the last focused window on the desktop, and ignore enter events + from the switch so it doesnt mess with the focus */ + XSync(ob_display, FALSE); + while (XCheckTypedEvent(ob_display, EnterNotify, &e)); + focus_fallback(Fallback_Desktop); + dispatch_ob(Event_Ob_Desktop, num, old); } @@ -376,14 +395,14 @@ void screen_show_desktop(gboolean show) for (it = g_list_last(stacking_list); it != NULL; it = it->prev) { Client *client = it->data; if (client->frame->visible && !client_should_show(client)) - engine_frame_hide(client->frame); + frame_hide(client->frame); } } else { /* top to bottom */ for (it = stacking_list; it != NULL; it = it->next) { Client *client = it->data; if (!client->frame->visible && client_should_show(client)) - engine_frame_show(client->frame); + frame_show(client->frame); } } @@ -415,7 +434,7 @@ void screen_install_colormap(Client *client, gboolean install) void screen_update_struts() { - GSList *it; + GList *it; guint i; g_free(strut); @@ -487,7 +506,7 @@ static void screen_update_area() */ if (!RECT_EQUAL(old_area, area[i])) { /* the area has changed, adjust all the maximized windows */ - GSList *it; + GList *it; for (it = client_list; it; it = it->next) { Client *c = it->data; if (i < screen_num_desktops) {