From f3bd8e7565a482dd4af9a26a51d94c36f9ac6704 Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Wed, 8 Oct 2008 17:15:53 -0700
Subject: don't show window on new workspace when warping with outline moving

---
 src/Screen.cc | 20 ++++++++------------
 src/Window.cc | 52 +++++++++++++---------------------------------------
 src/Window.hh |  2 --
 3 files changed, 21 insertions(+), 53 deletions(-)

diff --git a/src/Screen.cc b/src/Screen.cc
index 07f55c4..e6d10ff 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1113,6 +1113,12 @@ void BScreen::changeWorkspaceID(unsigned int id, bool revert) {
 
     FbTk::App::instance()->sync(false);
 
+    FluxboxWindow *focused = FocusControl::focusedFbWindow();
+
+    if (focused && focused->isMoving() && doOpaqueMove())
+        // don't reassociate if not opaque moving
+        reassociateWindow(focused, id, true);
+
     // set new workspace
     Workspace *old = currentWorkspace();
     m_current_workspace = getWorkspace(id);
@@ -1120,15 +1126,6 @@ void BScreen::changeWorkspaceID(unsigned int id, bool revert) {
     // we show new workspace first in order to appear faster
     currentWorkspace()->showAll();
 
-    FluxboxWindow *focused = FocusControl::focusedFbWindow();
-
-    if (focused && focused->isMoving()) {
-        if (doOpaqueMove())
-            reassociateWindow(focused, id, true);
-        // don't reassociate if not opaque moving
-        focused->pauseMoving();
-    }
-
     // reassociate all windows that are stuck to the new workspace
     Workspace::Windows wins = old->windowList();
     Workspace::Windows::iterator it = wins.begin();
@@ -1145,10 +1142,9 @@ void BScreen::changeWorkspaceID(unsigned int id, bool revert) {
             (*icon_it)->setWorkspace(id);
     }
 
-    if (focused && focused->isMoving()) {
+    if (focused && focused->isMoving() && doOpaqueMove())
         focused->focus();
-        focused->resumeMoving();
-    } else if (revert)
+    else if (revert)
         FocusControl::revertFocus(*this);
 
     old->hideAll(false);
diff --git a/src/Window.cc b/src/Window.cc
index 8c50f39..e29e761 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2462,6 +2462,14 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
             m_last_resize_x = me.x_root;
             m_last_resize_y = me.y_root;
 
+            // undraw rectangle before warping workspaces
+            if (!screen().doOpaqueMove()) {
+                parent().drawRectangle(screen().rootTheme()->opGC(),
+                                       m_last_move_x, m_last_move_y,
+                                       frame().width() + 2*frame().window().borderWidth()-1,
+                                       frame().height() + 2*frame().window().borderWidth()-1);
+            }
+
             if (moved_x && screen().isWorkspaceWarping()) {
                 unsigned int cur_id = screen().currentWorkspaceID();
                 unsigned int new_id = cur_id;
@@ -2492,7 +2500,10 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
                     XWarpPointer(display, None, me.root, 0, 0, 0, 0,
                                  m_last_resize_x, m_last_resize_y);
 
-                    screen().sendToWorkspace(new_id, this, true);
+                    if (screen().doOpaqueMove())
+                        screen().sendToWorkspace(new_id, this, true);
+                    else
+                        screen().changeWorkspaceID(new_id, false);
                 }
             }
 
@@ -2505,12 +2516,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
             // dx = current left side, dy = current top
             doSnapping(dx, dy);
 
-            if (! screen().doOpaqueMove()) {
-                parent().drawRectangle(screen().rootTheme()->opGC(),
-                                       m_last_move_x, m_last_move_y,
-                                       frame().width() + 2*frame().window().borderWidth()-1,
-                                       frame().height() + 2*frame().window().borderWidth()-1);
-
+            if (!screen().doOpaqueMove()) {
                 parent().drawRectangle(screen().rootTheme()->opGC(),
                                        dx, dy,
                                        frame().width() + 2*frame().window().borderWidth()-1,
@@ -2874,38 +2880,6 @@ void FluxboxWindow::stopMoving(bool interrupted) {
     FbTk::App::instance()->sync(false); //make sure the redraw is made before we continue
 }
 
-void FluxboxWindow::pauseMoving() {
-    if (screen().doOpaqueMove()) {
-        return;
-    }
-
-    parent().drawRectangle(screen().rootTheme()->opGC(),
-                           m_last_move_x, m_last_move_y,
-                           frame().width() + 2*frame().window().borderWidth()-1,
-                           frame().height() + 2*frame().window().borderWidth()-1);
-
-}
-
-
-void FluxboxWindow::resumeMoving() {
-    if (screen().doOpaqueMove()) {
-        return;
-    }
-
-    if (m_workspace_number == screen().currentWorkspaceID()) {
-        frame().show();
-        focus();
-    }
-
-    FbTk::App::instance()->sync(false);
-
-    parent().drawRectangle(screen().rootTheme()->opGC(),
-                           m_last_move_x, m_last_move_y,
-                           frame().width() + 2*frame().window().borderWidth()-1,
-                           frame().height() + 2*frame().window().borderWidth()-1);
-
-}
-
 /**
  * Helper function that snaps a window to another window
  * We snap if we're closer than the x/ylimits.
diff --git a/src/Window.hh b/src/Window.hh
index 27901d2..97ece55 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -297,8 +297,6 @@ public:
     // popup menu on last button press position
     void popupMenu();
 
-    void pauseMoving();
-    void resumeMoving();
     /**
        @name event handlers
     */
-- 
cgit v0.11.2