X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=7e2d8645ce3fd3602f7c1d37615f90246cbfec7e;hb=8f2e3f5fe16aeb0324aa5ee2b2c30a83ec724ad0;hp=9cfc1850250455c33f928d52224196d888f06792;hpb=8772b46b56172e35506f21d626aa89bd649615c6;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 9cfc1850..7e2d8645 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -543,6 +543,7 @@ void screen_set_desktop(guint num, gboolean dofocus) GList *it; guint old; gulong ignore_start; + gboolean allow_omni; g_assert(num < screen_num_desktops); @@ -574,10 +575,11 @@ void screen_set_desktop(guint num, gboolean dofocus) } } - if (focus_client && ((client_normal(focus_client) && - focus_client->desktop == DESKTOP_ALL) || - focus_client->desktop == screen_desktop)) - dofocus = FALSE; + /* only allow omnipresent windows to get focus on desktop change if + an omnipresent window is already focused (it'll keep focus probably, but + maybe not depending on mouse-focus options) */ + allow_omni = focus_client && (client_normal(focus_client) && + focus_client->desktop == DESKTOP_ALL); /* have to try focus here because when you leave an empty desktop there is no focus out to watch for. also, we have different rules @@ -587,7 +589,7 @@ void screen_set_desktop(guint num, gboolean dofocus) do this before hiding the windows so if helper windows are coming with us, they don't get hidden */ - if (dofocus && (c = focus_fallback(TRUE, !config_focus_last, FALSE))) + if (dofocus && (c = focus_fallback(TRUE, !config_focus_last, allow_omni))) { /* only do the flicker reducing stuff ahead of time if we are going to call xsetinputfocus on the window ourselves. otherwise there is @@ -731,7 +733,7 @@ void screen_desktop_popup(guint d, gboolean show) if (!show) { pager_popup_hide(desktop_cycle_popup); } else { - a = screen_physical_area_monitor(0); + a = screen_physical_area_monitor_active(); pager_popup_position(desktop_cycle_popup, CenterGravity, a->x + a->width / 2, a->y + a->height / 2); pager_popup_icon_size_multiplier(desktop_cycle_popup, @@ -1365,6 +1367,24 @@ Rect *screen_physical_area_monitor(guint head) return &monitor_area[head]; } +Rect *screen_physical_area_monitor_active() +{ + Rect *a; + gint x, y; + + if (focus_client) + a = screen_physical_area_monitor(client_monitor(focus_client)); + else { + Rect mon; + if (screen_pointer_pos(&x, &y)) + RECT_SET(mon, x, y, 1, 1); + else + RECT_SET(mon, 0, 0, 1, 1); + a = screen_physical_area_monitor(screen_find_monitor(&mon)); + } + return a; +} + void screen_set_root_cursor() { if (sn_app_starting())