X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=a051d25039d2753dcb5b391eba6a10689490d014;hb=b23c66afd15be9976a80f184df0d044919c56582;hp=928c1ef62c6d8c3180f8f64050a03be949fec845;hpb=08a70966ee8fdec4204ab1ca9aed1371b1c828d0;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 928c1ef6..a051d250 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -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); }