all repos — openbox @ 0cfd92ab9e56d8f790c92b83436e981fa46efe20

openbox fork - make it a bit more like ryudo

don't make omnipresent windows lose focus when changing desktops.  this is done by allowing focus_fallback to specify if focus has been lost or not.  usually if you're call it, focus is lost, but not always.
Dana Jansens danakj@orodu.net
commit

0cfd92ab9e56d8f790c92b83436e981fa46efe20

parent

ac59dd4fe53330d717a12f55f6bfc17467ad2ae2

5 files changed, 18 insertions(+), 13 deletions(-)

jump to
M openbox/actions/unfocus.copenbox/actions/unfocus.c

@@ -12,6 +12,6 @@ /* Always return FALSE because its not interactive */

static gboolean run_func(ObActionsData *data, gpointer options) { if (data->client && data->client == focus_client) - focus_fallback(FALSE, FALSE, TRUE); + focus_fallback(FALSE, FALSE, TRUE, FALSE); return FALSE; }
M openbox/event.copenbox/event.c

@@ -489,7 +489,7 @@ "Focus went to the frame window");

focus_left_screen = FALSE; - focus_fallback(FALSE, config_focus_under_mouse, TRUE); + focus_fallback(FALSE, config_focus_under_mouse, TRUE, TRUE); /* We don't get a FocusOut for this case, because it's just moving from our Inferior up to us. This happens when iconifying a

@@ -498,10 +498,10 @@ frame_adjust_focus(client->frame, FALSE);

/* focus_set_client(NULL) has already been called */ client_calc_layer(client); } - if (e->xfocus.detail == NotifyPointerRoot || - e->xfocus.detail == NotifyDetailNone || - e->xfocus.detail == NotifyInferior || - e->xfocus.detail == NotifyNonlinear) + else if (e->xfocus.detail == NotifyPointerRoot || + e->xfocus.detail == NotifyDetailNone || + e->xfocus.detail == NotifyInferior || + e->xfocus.detail == NotifyNonlinear) { XEvent ce;

@@ -541,7 +541,8 @@ worry about focusing an invalid window

*/ if (!focus_left_screen) - focus_fallback(FALSE, config_focus_under_mouse, TRUE); + focus_fallback(FALSE, config_focus_under_mouse, + TRUE, TRUE); } } else if (!client)

@@ -597,7 +598,7 @@ that isn't a client. */

ob_debug_type(OB_DEBUG_FOCUS, "Focus went to an unmanaged window 0x%x !\n", ce.xfocus.window); - focus_fallback(TRUE, config_focus_under_mouse, TRUE); + focus_fallback(TRUE, config_focus_under_mouse, TRUE, TRUE); } }
M openbox/focus.copenbox/focus.c

@@ -159,7 +159,7 @@ return NULL;

} ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer, - gboolean allow_omnipresent) + gboolean allow_omnipresent, gboolean focus_lost) { ObClient *new; ObClient *old = focus_client;

@@ -167,7 +167,8 @@

/* unfocus any focused clients.. they can be focused by Pointer events and such, and then when we try focus them, we won't get a FocusIn event at all for them. */ - focus_nothing(); + if (focus_lost) + focus_nothing(); new = focus_fallback_target(allow_refocus, allow_pointer, allow_omnipresent, old);
M openbox/focus.hopenbox/focus.h

@@ -46,7 +46,8 @@

/*! Call this when you need to focus something! */ struct _ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer, - gboolean allow_omnipresent); + gboolean allow_omnipresent, + gboolean focus_lost); /*! Add a new client into the focus order */ void focus_order_add_new(struct _ObClient *c);
M openbox/screen.copenbox/screen.c

@@ -560,7 +560,9 @@

do this before hiding the windows so if helper windows are coming with us, they don't get hidden */ - if ((c = focus_fallback(TRUE, !config_focus_last, allow_omni))) { + if ((c = focus_fallback(TRUE, !config_focus_last, allow_omni, + !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 no guarantee the window will actually take focus.. */

@@ -1137,7 +1139,7 @@ }

else if (!show_only) { ObClient *c; - if ((c = focus_fallback(TRUE, FALSE, TRUE))) { + if ((c = focus_fallback(TRUE, FALSE, TRUE, FALSE))) { /* only do the flicker reducing stuff ahead of time if we are going to call xsetinputfocus on the window ourselves. otherwise there is no guarantee the window will actually take focus.. */