use focus history when focus(NULL)

This commit is contained in:
Julien Danjou 2007-12-28 10:12:34 +01:00
parent 3851e755df
commit 19cd145861
1 changed files with 9 additions and 3 deletions

View File

@ -223,9 +223,15 @@ focus(Client *c, Bool selscreen, int screen)
globalconf.screens[screen].opacity_unfocused);
}
/* if c is NULL or invisible, take next client in the stack */
/* if c is NULL or invisible, take next client in the focus history */
if((!c && selscreen) || (c && !client_isvisible(c, screen)))
for(c = globalconf.clients; c && !client_isvisible(c, screen); c = c->next);
{
c = focus_get_current_client(screen);
/* if c is still NULL take next client in the stack */
if(!c)
for(c = globalconf.clients; c && !client_isvisible(c, screen); c = c->next);
}
if(c)
{
@ -237,7 +243,7 @@ focus(Client *c, Bool selscreen, int screen)
if(!selscreen)
return;
/* save old sel in focus history */
/* save sel in focus history */
focus_add_client(c);
statusbar_draw(screen);