allow focus to fallback to omnipresent windows, except during desktop switching which is when they are vile
This commit is contained in:
parent
9a7c4de2eb
commit
8772b46b56
5 changed files with 16 additions and 11 deletions
|
@ -1314,7 +1314,7 @@ void action_focus(union ActionData *data)
|
|||
void action_unfocus (union ActionData *data)
|
||||
{
|
||||
if (data->client.any.c == focus_client)
|
||||
focus_fallback(FALSE, FALSE);
|
||||
focus_fallback(FALSE, FALSE, TRUE);
|
||||
}
|
||||
|
||||
void action_iconify(union ActionData *data)
|
||||
|
|
|
@ -499,7 +499,7 @@ static void event_process(const XEvent *ec, gpointer data)
|
|||
|
||||
focus_left_screen = FALSE;
|
||||
|
||||
focus_fallback(FALSE, FALSE);
|
||||
focus_fallback(FALSE, FALSE, 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
|
||||
|
@ -551,7 +551,7 @@ static void event_process(const XEvent *ec, gpointer data)
|
|||
*/
|
||||
|
||||
if (!focus_left_screen)
|
||||
focus_fallback(FALSE, FALSE);
|
||||
focus_fallback(FALSE, FALSE, TRUE);
|
||||
}
|
||||
}
|
||||
else if (!client)
|
||||
|
@ -607,7 +607,7 @@ static void event_process(const XEvent *ec, gpointer data)
|
|||
ob_debug_type(OB_DEBUG_FOCUS,
|
||||
"Focus went to an unmanaged window 0x%x !\n",
|
||||
ce.xfocus.window);
|
||||
focus_fallback(TRUE, FALSE);
|
||||
focus_fallback(TRUE, FALSE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ void focus_set_client(ObClient *client)
|
|||
|
||||
static ObClient* focus_fallback_target(gboolean allow_refocus,
|
||||
gboolean allow_pointer,
|
||||
gboolean allow_omnipresent,
|
||||
ObClient *old)
|
||||
{
|
||||
GList *it;
|
||||
|
@ -118,12 +119,13 @@ static ObClient* focus_fallback_target(gboolean allow_refocus,
|
|||
c = it->data;
|
||||
/* fallback focus to a window if:
|
||||
1. it is on the current desktop. this ignores omnipresent
|
||||
windows, which are problematic in their own rite.
|
||||
windows, which are problematic in their own rite, unless they are
|
||||
specifically allowed
|
||||
2. it is a normal type window, don't fall back onto a dock or
|
||||
a splashscreen or a desktop window (save the desktop as a
|
||||
backup fallback though)
|
||||
*/
|
||||
if (c->desktop == screen_desktop &&
|
||||
if ((allow_omnipresent || c->desktop == screen_desktop) &&
|
||||
client_normal(c) &&
|
||||
(allow_refocus || client_focus_target(c) != old) &&
|
||||
client_focus(c))
|
||||
|
@ -155,7 +157,8 @@ static ObClient* focus_fallback_target(gboolean allow_refocus,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer)
|
||||
ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer,
|
||||
gboolean allow_omnipresent)
|
||||
{
|
||||
ObClient *new;
|
||||
ObClient *old = focus_client;
|
||||
|
@ -165,7 +168,8 @@ ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer)
|
|||
event at all for them. */
|
||||
focus_nothing();
|
||||
|
||||
new = focus_fallback_target(allow_refocus, allow_pointer, old);
|
||||
new = focus_fallback_target(allow_refocus, allow_pointer,
|
||||
allow_omnipresent, old);
|
||||
/* get what was really focused */
|
||||
if (new) new = client_focus_target(new);
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ void focus_nothing();
|
|||
|
||||
/*! Call this when you need to focus something! */
|
||||
struct _ObClient* focus_fallback(gboolean allow_refocus,
|
||||
gboolean allow_pointer);
|
||||
gboolean allow_pointer,
|
||||
gboolean allow_omnipresent);
|
||||
|
||||
/*! Add a new client into the focus order */
|
||||
void focus_order_add_new(struct _ObClient *c);
|
||||
|
|
|
@ -587,7 +587,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)))
|
||||
if (dofocus && (c = focus_fallback(TRUE, !config_focus_last, FALSE)))
|
||||
{
|
||||
/* only do the flicker reducing stuff ahead of time if we are going
|
||||
to call xsetinputfocus on the window ourselves. otherwise there is
|
||||
|
@ -1050,7 +1050,7 @@ void screen_show_desktop(gboolean show, ObClient *show_only)
|
|||
else if (!show_only) {
|
||||
ObClient *c;
|
||||
|
||||
if ((c = focus_fallback(TRUE, FALSE))) {
|
||||
if ((c = focus_fallback(TRUE, FALSE, TRUE))) {
|
||||
/* 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.. */
|
||||
|
|
Loading…
Reference in a new issue