From cd119aacbd97fca71ce3da5926b89f528f468fb1 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <fourdan.olivier@wanadoo.fr>
Date: Sun, 20 Nov 2005 10:06:50 +0000
Subject: [PATCH] Fix windows disapearing when moved between workspaces before
 initial mapping (bug #1236)

(Old svn revision: 18899)
---
 src/client.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/client.c b/src/client.c
index d66521580..0cb1812b6 100644
--- a/src/client.c
+++ b/src/client.c
@@ -2143,6 +2143,7 @@ clientSetWorkspace (Client * c, int ws, gboolean manage_mapping)
     GList *list_of_windows = NULL;
     GList *index = NULL;
     Client *c2 = NULL;
+    int previous_ws = 0;
 
     g_return_if_fail (c != NULL);
 
@@ -2152,27 +2153,23 @@ clientSetWorkspace (Client * c, int ws, gboolean manage_mapping)
     for (index = list_of_windows; index; index = g_list_next (index))
     {
         c2 = (Client *) index->data;
+
         if (c2->win_workspace != ws)
         {
             TRACE ("setting client \"%s\" (0x%lx) to current_ws %d", c->name, c->window, ws);
+
+            previous_ws = c2->win_workspace;
             clientSetWorkspaceSingle (c2, ws);
-            if (manage_mapping && !clientIsValidTransientOrModal (c2)
-                && !FLAG_TEST (c2->flags, CLIENT_FLAG_ICONIFIED))
+
+            if (manage_mapping && !clientIsValidTransientOrModal (c2) && !FLAG_TEST (c2->flags, CLIENT_FLAG_ICONIFIED))
             {
-                if (FLAG_TEST (c2->flags, CLIENT_FLAG_STICKY))
+                if (previous_ws == c2->screen_info->current_ws)
                 {
-                    clientShow (c2, FALSE);
+                    clientHide (c2, c2->screen_info->current_ws, FALSE);
                 }
-                else
+                if (FLAG_TEST (c2->flags, CLIENT_FLAG_STICKY) || (ws == c2->screen_info->current_ws))
                 {
-                    if (ws == c2->screen_info->current_ws)
-                    {
-                        clientShow (c2, FALSE);
-                    }
-                    else
-                    {
-                        clientHide (c2, c2->screen_info->current_ws, FALSE);
-                    }
+                    clientShow (c2, FALSE);
                 }
             }
         }
-- 
GitLab