Focus stealing prevention - should fix FS#497
We should prevent focus stealing, in case when there are e.g. 2 clients on separate tags, first client has focus, and we receive FocusIn event for second (invisible) client. This patch adds prevention in the focus update handler. It sets focus on previously focused client, when FocusIn event destination is invisible(untagged) client. This should fix FS#497. Signed-off-by: Mariusz Ceier <mceier@gmail.com> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
a91e31dbe6
commit
e8de7a4605
11
client.c
11
client.c
|
@ -217,6 +217,9 @@ client_ban(client_t *c)
|
|||
if(client_hasstrut(c))
|
||||
wibox_update_positions();
|
||||
|
||||
if(globalconf.screens.tab[c->phys_screen].prev_client_focus == c)
|
||||
globalconf.screens.tab[c->phys_screen].prev_client_focus = NULL;
|
||||
|
||||
/* Wait until the last moment to take away the focus from the window. */
|
||||
if(globalconf.screens.tab[c->phys_screen].client_focus == c)
|
||||
client_unfocus(c);
|
||||
|
@ -230,7 +233,11 @@ void
|
|||
client_focus_update(client_t *c)
|
||||
{
|
||||
if(!client_maybevisible(c, c->screen))
|
||||
{
|
||||
/* Focus previously focused client */
|
||||
client_focus(globalconf.screen_focus->prev_client_focus);
|
||||
return;
|
||||
}
|
||||
|
||||
/* stop hiding client */
|
||||
c->ishidden = false;
|
||||
|
@ -240,6 +247,7 @@ client_focus_update(client_t *c)
|
|||
client_unban(c);
|
||||
|
||||
globalconf.screen_focus = &globalconf.screens.tab[c->phys_screen];
|
||||
globalconf.screen_focus->prev_client_focus = c;
|
||||
globalconf.screen_focus->client_focus = c;
|
||||
|
||||
/* Some layouts use focused client differently, so call them back.
|
||||
|
@ -1224,6 +1232,9 @@ client_unmanage(client_t *c)
|
|||
tc->transient_for = NULL;
|
||||
}
|
||||
|
||||
if(globalconf.screens.tab[c->phys_screen].prev_client_focus == c)
|
||||
globalconf.screens.tab[c->phys_screen].prev_client_focus = NULL;
|
||||
|
||||
if(globalconf.screens.tab[c->phys_screen].client_focus == c)
|
||||
client_unfocus(c);
|
||||
|
||||
|
|
Loading…
Reference in New Issue