From: Dana Jansens Date: Thu, 17 Dec 2009 23:32:10 +0000 (-0500) Subject: Merge branch 'backport' into 3.4-working X-Git-Tag: release-3.4.9~1 X-Git-Url: http://git.openbox.org/?p=mikachu%2Fopenbox.git;a=commitdiff_plain;h=29ecb62a556e7223a936020919469badf18a958b;hp=997bc9947537e1e49827648ea6a17067de5f09c9 Merge branch 'backport' into 3.4-working --- diff --git a/openbox/event.c b/openbox/event.c index d5791a0..a0d26ab 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1918,9 +1918,6 @@ static gboolean focus_delay_func(gpointer data) ObFocusDelayData *d = data; Time old = event_curtime; - /* don't move focus and kill the menu or the move/resize */ - if (menu_frame_visible || moveresize_in_progress) return FALSE; - event_curtime = d->time; event_curserial = d->serial; if (client_focus(d->client) && config_focus_raise) diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index 20a738f..8d04749 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -56,12 +56,8 @@ void focus_cycle_stop(ObClient *ifclient) /* stop focus cycling if the given client is a valid focus target, and so the cycling is being disrupted */ if (focus_cycle_target && ifclient && - focus_valid_target(ifclient, TRUE, - focus_cycle_iconic_windows, - focus_cycle_all_desktops, - focus_cycle_dock_windows, - focus_cycle_desktop_windows, - FALSE)) + (ifclient == focus_cycle_target || + focus_cycle_popup_is_showing(ifclient))) { focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,TRUE); focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c index 740d668..d01be03 100644 --- a/openbox/focus_cycle_popup.c +++ b/openbox/focus_cycle_popup.c @@ -535,3 +535,17 @@ void focus_cycle_popup_single_hide(void) { icon_popup_hide(single_popup); } + +gboolean focus_cycle_popup_is_showing(ObClient *client) +{ + if (popup.mapped) { + GList *it; + + for (it = popup.targets; it; it = g_list_next(it)) { + ObFocusCyclePopupTarget *t = it->data; + if (t->client == client) + return TRUE; + } + } + return FALSE; +} diff --git a/openbox/focus_cycle_popup.h b/openbox/focus_cycle_popup.h index 4e8c775..731165b 100644 --- a/openbox/focus_cycle_popup.h +++ b/openbox/focus_cycle_popup.h @@ -39,4 +39,7 @@ void focus_cycle_popup_single_show(struct _ObClient *c, gboolean desktop_windows); void focus_cycle_popup_single_hide(void); +/*! Returns TRUE if the popup is showing the client, otherwise FALSE. */ +gboolean focus_cycle_popup_is_showing(struct _ObClient *client); + #endif diff --git a/openbox/geom.h b/openbox/geom.h index 7c5ee32..6a1725e 100644 --- a/openbox/geom.h +++ b/openbox/geom.h @@ -160,6 +160,6 @@ typedef struct _StrutPartial { (s1).bottom_end == (s2).bottom_end) #define RANGES_INTERSECT(r1x, r1w, r2x, r2w) \ - (r1x < r2x + r2w && r1x + r1w > r2x) + (r1w && r2w && r1x < r2x + r2w && r1x + r1w > r2x) #endif diff --git a/openbox/screen.c b/openbox/screen.c index 03e4efe..d88be43 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -33,6 +33,7 @@ #include "frame.h" #include "event.h" #include "focus.h" +#include "focus_cycle.h" #include "popup.h" #include "extensions.h" #include "render/render.h" @@ -717,15 +718,21 @@ void screen_set_desktop(guint num, gboolean dofocus) for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - client_hide(c); - if (c == focus_client) { - /* c was focused and we didn't do fallback clearly so make sure - openbox doesnt still consider the window focused. - this happens when using NextWindow with allDesktops, since - it doesnt want to move focus on desktop change, but the - focus is not going to stay with the current window, which - has now disappeared */ - focus_set_client(NULL); + if (client_hide(c)) { + /* in the middle of cycling..? kill it. */ + focus_cycle_stop(c); + + if (c == focus_client) { + /* c was focused and we didn't do fallback clearly so make + sure openbox doesnt still consider the window focused. + this happens when using NextWindow with allDesktops, + since it doesnt want to move focus on desktop change, + but the focus is not going to stay with the current + window, which has now disappeared. + only do this if the client was actually hidden, + otherwise it can keep focus. */ + focus_set_client(NULL); + } } } }