handle focus history on arrange()

This commit is contained in:
Julien Danjou 2008-01-25 22:50:18 +01:00
parent 485614f2df
commit 6f1e1e1abe
2 changed files with 7 additions and 1 deletions

View File

@ -150,6 +150,7 @@ client_unfocus(Client *c)
XSetWindowBorder(globalconf.display, c->win, XSetWindowBorder(globalconf.display, c->win,
globalconf.screens[c->screen].colors_normal[ColBorder].pixel); globalconf.screens[c->screen].colors_normal[ColBorder].pixel);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS); widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
focus_add_client(NULL);
} }
/** Ban client and unmap it /** Ban client and unmap it
@ -187,10 +188,10 @@ focus(Client *c, int screen)
client_unfocus(globalconf.focus->client); client_unfocus(globalconf.focus->client);
/* save sel in focus history */ /* save sel in focus history */
focus_add_client(c);
if(c) if(c)
{ {
focus_add_client(c);
XSetWindowBorder(globalconf.display, c->win, XSetWindowBorder(globalconf.display, c->win,
globalconf.screens[screen].colors_selected[ColBorder].pixel); globalconf.screens[screen].colors_selected[ColBorder].pixel);
XSetInputFocus(globalconf.display, c->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(globalconf.display, c->win, RevertToPointerRoot, CurrentTime);

View File

@ -81,6 +81,11 @@ arrange(int screen)
if(!globalconf.screens[screen].allow_lower_floats) if(!globalconf.screens[screen].allow_lower_floats)
layout_raise_floatings(screen); layout_raise_floatings(screen);
/* if we have a valid client that could be focused but currently no window
* are focused, then set the focus on this window */
if((c = focus_get_current_client(screen)) && !globalconf.focus->client)
focus(c, screen);
/* reset status */ /* reset status */
globalconf.screens[screen].need_arrange = False; globalconf.screens[screen].need_arrange = False;
} }