X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=3145a63c1d09f269ed8efe31b061da8cbb33cfd5;hb=f278ec41e4c310da218563e7d443df32783e26e4;hp=5c0f255f422e784c69ac686420b5b0b22d75838e;hpb=d1de946a62c73634ae86384f9f33b2dd2fce4941;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 5c0f255f..3145a63c 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -208,7 +208,7 @@ void screen_set_num_desktops(guint num) { guint i, old; gulong *viewport; - GSList *it; + GList *it; g_assert(num > 0); @@ -244,7 +244,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(num - 1); + client_set_desktop(c, num - 1, FALSE); } dispatch_ob(Event_Ob_NumDesktops, num, old); @@ -258,17 +258,18 @@ void screen_set_desktop(guint num) { GList *it; guint old; + XEvent e; 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); 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 */ @@ -285,6 +286,12 @@ void screen_set_desktop(guint num) engine_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(TRUE); + dispatch_ob(Event_Ob_Desktop, num, old); } @@ -417,7 +424,7 @@ void screen_install_colormap(Client *client, gboolean install) void screen_update_struts() { - GSList *it; + GList *it; guint i; g_free(strut); @@ -489,7 +496,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) {