From 90f4d5b4506b418bf6d49c938470840140086654 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <fourdan.olivier@wanadoo.fr> Date: Thu, 15 May 2003 22:06:56 +0000 Subject: [PATCH] Fix a problem with focus not being restored on transients when switching workspaces (Old svn revision: 11115) --- src/workspaces.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/workspaces.c b/src/workspaces.c index baa5d953a..8b516e15b 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -40,6 +40,7 @@ void workspaceSwitch(int new_ws, Client * c2) Client *previous; GSList *list_of_windows; GSList *index; + GSList *list_hide; Window dr, window; int rx, ry, wx, wy; unsigned int mask; @@ -68,6 +69,7 @@ void workspaceSwitch(int new_ws, Client * c2) clientSetWorkspace(c2, new_ws, FALSE); } + list_hide = NULL; previous = clientGetFocus(); list_of_windows = clientGetStackList(); /* First pass */ @@ -83,11 +85,27 @@ void workspaceSwitch(int new_ws, Client * c2) } if (!clientIsTransient(c)) { - clientHide(c, new_ws, FALSE); + /* Just build of windows that will be hidden, so that + we can record the previous focus even when on a + transient (otherwise the transient vanishes along + with its parent window which is placed below... + */ + list_hide = g_slist_append(list_hide, c); } } } + /* First pass and a half :) */ + if (list_hide) + { + for(index = list_hide; index; index = g_slist_next(index)) + { + c = (Client *) index->data; + clientHide(c, new_ws, FALSE); + } + g_slist_free(list_hide); + } + /* Second pass */ list_of_windows = g_slist_reverse(list_of_windows); for(index = list_of_windows; index; index = g_slist_next(index)) -- GitLab