From c381a130eb044f3ea643dcd864be5732f14f8014 Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Tue, 18 Dec 2007 23:08:17 -0800
Subject: remove reassoc argument from FluxboxWindow::deiconify

---
 src/FbCommands.cc |  4 ++--
 src/Gnome.cc      |  2 +-
 src/Window.cc     | 60 ++++++++++++++++++++-----------------------------------
 src/Window.hh     |  3 +--
 4 files changed, 26 insertions(+), 43 deletions(-)

diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 747eb3c..479c5c8 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -534,7 +534,7 @@ void DeiconifyCmd::execute() {
                 (*it)->isStuck()) {
                 if (m_dest == ORIGIN || m_dest == ORIGINQUIET)
                     screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
-                (*it)->deiconify(false);
+                (*it)->deiconify();
             }
         }
         break;
@@ -550,7 +550,7 @@ void DeiconifyCmd::execute() {
                     m_mode != LASTWORKSPACE)
                     screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
                 else
-                    (*it)->deiconify(false);
+                    (*it)->deiconify();
                 break;
             }
         }
diff --git a/src/Gnome.cc b/src/Gnome.cc
index 5bdb986..e570526 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -396,7 +396,7 @@ void Gnome::setState(FluxboxWindow *win, int state) {
         if (win->isIconic())
             win->iconify();
     } else if (win->isIconic())
-        win->deiconify(true, true);
+        win->deiconify(true);
 
     if (state & WIN_STATE_SHADED) {
 #ifdef DEBUG
diff --git a/src/Window.cc b/src/Window.cc
index c48a6ff..125347b 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -545,7 +545,7 @@ void FluxboxWindow::init() {
         iconify();
     } else if (m_workspace_number == screen().currentWorkspaceID()) {
         iconic = true;
-        deiconify(false);
+        deiconify();
         // check if we should prevent this window from gaining focus
         if (!allowsFocusFromClient() || Fluxbox::instance()->isStartup())
             m_focused = false;
@@ -1416,57 +1416,41 @@ void FluxboxWindow::iconify() {
     // focus revert is done elsewhere (based on signal)
 }
 
-void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
-    if (numClients() == 0)
+void FluxboxWindow::deiconify(bool do_raise) {
+    if (numClients() == 0 || !iconic || oplock)
         return;
 
-    if (oplock) return;
     oplock = true;
 
-    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;
-    }
-
-    bool was_iconic = iconic;
-
+    // reassociate first, so it gets removed from screen's icon list
+    screen().reassociateWindow(this, m_workspace_number, false);
     iconic = false;
     m_statesig.notify();
 
-    if (reassoc && !m_client->transients.empty()) {
-        // deiconify all transients
-        ClientList::iterator client_it = clientList().begin();
-        ClientList::iterator client_it_end = clientList().end();
-        for (; client_it != client_it_end; ++client_it) {
-            //TODO: Can this get stuck in a loop?
-            WinClient::TransientList::iterator trans_it =
-                (*client_it)->transientList().begin();
-            WinClient::TransientList::iterator trans_it_end =
-                (*client_it)->transientList().end();
-            for (; trans_it != trans_it_end; ++trans_it) {
-                if ((*trans_it)->fbwindow())
-                    (*trans_it)->fbwindow()->deiconify(true, false);
-            }
+    // deiconify all transients
+    ClientList::iterator client_it = clientList().begin();
+    ClientList::iterator client_it_end = clientList().end();
+    for (; client_it != client_it_end; ++client_it) {
+        WinClient::TransientList::iterator trans_it =
+            (*client_it)->transientList().begin();
+        WinClient::TransientList::iterator trans_it_end =
+            (*client_it)->transientList().end();
+        for (; trans_it != trans_it_end; ++trans_it) {
+            if ((*trans_it)->fbwindow())
+                (*trans_it)->fbwindow()->deiconify(false);
         }
     }
 
+    if (m_workspace_number != screen().currentWorkspaceID())
+        return;
+
     show();
 
     // focus new, OR if it's the only window on the workspace
     // but not on startup: focus will be handled after creating everything
     // we use m_focused as a signal to focus the window when mapped
-    if (was_iconic && (screen().currentWorkspace()->numberOfWindows() == 1 ||
-        screen().focusControl().focusNew() || m_client->isTransient()))
+    if (screen().currentWorkspace()->numberOfWindows() == 1 ||
+        screen().focusControl().focusNew() || m_client->isTransient())
         m_focused = true;
 
     oplock = false;
@@ -2231,7 +2215,7 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
         return;
 
     setCurrentClient(*client, false); // focus handled on MapNotify
-    deiconify(false);
+    deiconify();
 
 }
 
diff --git a/src/Window.hh b/src/Window.hh
index d2529bc..821e86a 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -256,10 +256,9 @@ public:
     void iconify();
     /**
      * Deiconify window
-     * @param reassoc reassociate the window to the current workspace
      * @param do_raise raise the window when its been deiconfied
      */
-    void deiconify(bool reassoc = true, bool do_raise = true);
+    void deiconify(bool do_raise = true);
 
     // ------------------
     // Per window transparency addons
-- 
cgit v0.11.2