From 6f1e1e1abeafdb3c5c1c849d7db0311b0daa8b79 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 25 Jan 2008 22:50:18 +0100 Subject: [PATCH] handle focus history on arrange() --- client.c | 3 ++- layout.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client.c b/client.c index 5ad9814f..47d64675 100644 --- a/client.c +++ b/client.c @@ -150,6 +150,7 @@ client_unfocus(Client *c) XSetWindowBorder(globalconf.display, c->win, globalconf.screens[c->screen].colors_normal[ColBorder].pixel); widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS); + focus_add_client(NULL); } /** Ban client and unmap it @@ -187,10 +188,10 @@ focus(Client *c, int screen) client_unfocus(globalconf.focus->client); /* save sel in focus history */ - focus_add_client(c); if(c) { + focus_add_client(c); XSetWindowBorder(globalconf.display, c->win, globalconf.screens[screen].colors_selected[ColBorder].pixel); XSetInputFocus(globalconf.display, c->win, RevertToPointerRoot, CurrentTime); diff --git a/layout.c b/layout.c index 50ba141c..b3d49160 100644 --- a/layout.c +++ b/layout.c @@ -81,6 +81,11 @@ arrange(int screen) if(!globalconf.screens[screen].allow_lower_floats) 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 */ globalconf.screens[screen].need_arrange = False; } -- 2.11.4.GIT