prevent flicker in the follow actiosn again instead of in focus fallback. focus fallback needs to be very reliable.
This commit is contained in:
parent
7cf4c970ae
commit
336011efb1
3 changed files with 16 additions and 38 deletions
|
@ -1588,7 +1588,7 @@ void action_send_to_desktop(union ActionData *data)
|
||||||
data->sendto.desk == DESKTOP_ALL) {
|
data->sendto.desk == DESKTOP_ALL) {
|
||||||
client_set_desktop(c, data->sendto.desk, data->sendto.follow);
|
client_set_desktop(c, data->sendto.desk, data->sendto.follow);
|
||||||
if (data->sendto.follow && data->sendto.desk != screen_desktop)
|
if (data->sendto.follow && data->sendto.desk != screen_desktop)
|
||||||
screen_set_desktop(data->sendto.desk, TRUE);
|
screen_set_desktop(data->sendto.desk, c != focus_client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1601,7 +1601,7 @@ void action_desktop(union ActionData *data)
|
||||||
{
|
{
|
||||||
screen_set_desktop(data->desktop.desk, TRUE);
|
screen_set_desktop(data->desktop.desk, TRUE);
|
||||||
if (data->inter.any.interactive)
|
if (data->inter.any.interactive)
|
||||||
screen_desktop_popup(data->desktop.desk, TRUE);
|
screen_desktop_popup(data->desktop.desk, focus_client->desktop != DESKTOP_ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1621,7 +1621,7 @@ void action_desktop_dir(union ActionData *data)
|
||||||
if (!data->sendtodir.inter.any.interactive ||
|
if (!data->sendtodir.inter.any.interactive ||
|
||||||
(data->sendtodir.inter.final && !data->sendtodir.inter.cancel))
|
(data->sendtodir.inter.final && !data->sendtodir.inter.cancel))
|
||||||
{
|
{
|
||||||
if (d != screen_desktop) screen_set_desktop(d, TRUE);
|
if (d != screen_desktop) screen_set_desktop(d, focus_client->desktop != DESKTOP_ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,7 +1645,7 @@ void action_send_to_desktop_dir(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_set_desktop(c, d, data->sendtodir.follow);
|
client_set_desktop(c, d, data->sendtodir.follow);
|
||||||
if (data->sendtodir.follow && d != screen_desktop)
|
if (data->sendtodir.follow && d != screen_desktop)
|
||||||
screen_set_desktop(d, TRUE);
|
screen_set_desktop(d, c != focus_client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -526,10 +526,7 @@ static void event_process(const XEvent *ec, gpointer data)
|
||||||
|
|
||||||
/* If you send focus to a window and then it disappears, you can
|
/* If you send focus to a window and then it disappears, you can
|
||||||
get the FocusIn for it, after it is unmanaged.
|
get the FocusIn for it, after it is unmanaged.
|
||||||
Just wait for the next FocusOut/FocusIn pair, but note that
|
Just wait for the next FocusOut/FocusIn pair. */
|
||||||
nothing is focused now.
|
|
||||||
*/
|
|
||||||
focus_set_client(NULL);
|
|
||||||
}
|
}
|
||||||
else if (client != focus_client) {
|
else if (client != focus_client) {
|
||||||
focus_left_screen = FALSE;
|
focus_left_screen = FALSE;
|
||||||
|
|
|
@ -94,8 +94,7 @@ void focus_set_client(ObClient *client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old,
|
static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
|
||||||
gboolean send_focus)
|
|
||||||
{
|
{
|
||||||
GList *it;
|
GList *it;
|
||||||
ObClient *c;
|
ObClient *c;
|
||||||
|
@ -104,14 +103,10 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old,
|
||||||
if (config_focus_follow && !config_focus_last)
|
if (config_focus_follow && !config_focus_last)
|
||||||
if ((c = client_under_pointer()) &&
|
if ((c = client_under_pointer()) &&
|
||||||
(allow_refocus || c != old) &&
|
(allow_refocus || c != old) &&
|
||||||
client_normal(c) &&
|
(client_normal(c) &&
|
||||||
/* if we're sending focus then try to */
|
client_focus(c)))
|
||||||
((send_focus && client_focus(c)) ||
|
|
||||||
/* if not just see if we could try, or it's already focused */
|
|
||||||
(!send_focus && (c == old || client_can_focus(c)))))
|
|
||||||
{
|
{
|
||||||
ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff (%d)\n",
|
ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff\n");
|
||||||
send_focus);
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,11 +114,9 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old,
|
||||||
if (allow_refocus && old &&
|
if (allow_refocus && old &&
|
||||||
old->desktop == DESKTOP_ALL &&
|
old->desktop == DESKTOP_ALL &&
|
||||||
client_normal(old) &&
|
client_normal(old) &&
|
||||||
/* this one is only for when not sending focus, to keep it there */
|
client_focus(old))
|
||||||
!send_focus)
|
|
||||||
{
|
{
|
||||||
ob_debug_type(OB_DEBUG_FOCUS, "found in omnipresentness (%d)\n",
|
ob_debug_type(OB_DEBUG_FOCUS, "found in omnipresentness\n");
|
||||||
send_focus);
|
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,14 +134,9 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old,
|
||||||
if (c->desktop == screen_desktop &&
|
if (c->desktop == screen_desktop &&
|
||||||
client_normal(c) &&
|
client_normal(c) &&
|
||||||
(allow_refocus || c != old) &&
|
(allow_refocus || c != old) &&
|
||||||
/* if we're sending focus then try to */
|
client_focus(c))
|
||||||
((send_focus && client_focus(c)) ||
|
|
||||||
/* if not just see if we could try, or it's already focused */
|
|
||||||
(!send_focus && (c == old || client_can_focus(c)))))
|
|
||||||
{
|
{
|
||||||
ob_debug_type(OB_DEBUG_FOCUS, "found in focus order (%d) 0x%x "
|
ob_debug_type(OB_DEBUG_FOCUS, "found in focus order\n");
|
||||||
"from 0x%x\n",
|
|
||||||
send_focus, c, old);
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,13 +153,9 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old,
|
||||||
*/
|
*/
|
||||||
if (c->type == OB_CLIENT_TYPE_DESKTOP &&
|
if (c->type == OB_CLIENT_TYPE_DESKTOP &&
|
||||||
(allow_refocus || c != old) &&
|
(allow_refocus || c != old) &&
|
||||||
/* if we're sending focus then try to */
|
client_focus(c))
|
||||||
((send_focus && client_focus(c)) ||
|
|
||||||
/* if not just see if we could try, or it's already focused */
|
|
||||||
(!send_focus && (c == old || client_can_focus(c)))))
|
|
||||||
{
|
{
|
||||||
ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window (%d)\n",
|
ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window\n");
|
||||||
send_focus);
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,15 +168,12 @@ ObClient* focus_fallback(gboolean allow_refocus)
|
||||||
ObClient *new;
|
ObClient *new;
|
||||||
ObClient *old = focus_client;
|
ObClient *old = focus_client;
|
||||||
|
|
||||||
new = focus_fallback_target(allow_refocus, old, FALSE);
|
|
||||||
if (new == old) return;
|
|
||||||
|
|
||||||
/* unfocus any focused clients.. they can be focused by Pointer events
|
/* 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
|
and such, and then when we try focus them, we won't get a FocusIn
|
||||||
event at all for them. */
|
event at all for them. */
|
||||||
focus_nothing();
|
focus_nothing();
|
||||||
|
|
||||||
new = focus_fallback_target(allow_refocus, old, TRUE);
|
new = focus_fallback_target(allow_refocus, old);
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue