From d482cf6a54709a5867469835490c6a4a40f1a88e Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Fri, 23 Nov 2007 00:45:56 +0000
Subject: somewhat fixed DeiconifyCmd

---
 src/FbCommands.cc |  3 +--
 src/Screen.cc     |  2 +-
 src/Window.cc     | 14 +++++++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 28c0a30..1cc1afe 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -433,8 +433,7 @@ void DeiconifyCmd::execute() {
                 (*it)->isStuck()) {
                 if (m_dest == ORIGIN || m_dest == ORIGINQUIET)
                     screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
-                else
-                    (*it)->deiconify(false);
+                (*it)->deiconify(false);
             }
         }
         break;
diff --git a/src/Screen.cc b/src/Screen.cc
index 155a113..ebcaaed 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1263,7 +1263,7 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
 
     // if the window is on current workspace, show it; else hide it.
     if (id == currentWorkspace()->workspaceID() && !win->isIconic())
-        win->deiconify(false, false);
+        win->show();
     else {
         win->hide(true);
         FocusControl::revertFocus(*this);
diff --git a/src/Window.cc b/src/Window.cc
index 0db3b80..6a12664 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1415,9 +1415,17 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
     if (oplock) return;
     oplock = true;
 
-    if (iconic || reassoc) {
-        screen().reassociateWindow(this, screen().currentWorkspace()->workspaceID(), false);
-    } else if (moving || m_workspace_number != screen().currentWorkspace()->workspaceID()) {
+    if (iconic &&
+        m_workspace_number != screen().currentWorkspace()->workspaceID()) {
+        // reassociate first, so it gets removed from screen's icon list
+        screen().reassociateWindow(this, m_workspace_number, false);
+        iconic = false;
+        return;
+    }
+
+    if (iconic || reassoc)
+        screen().reassociateWindow(this, screen().currentWorkspaceID(), false);
+    else if (moving || m_workspace_number != screen().currentWorkspaceID()) {
         oplock = false;
         return;
     }
-- 
cgit v0.11.2