summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-08-21 08:59:28 +0000
committerDana Jansens <danakj@orodu.net>2002-08-21 08:59:28 +0000
commit9d40660bce8e594b6065db961b770d69c46ae53b (patch)
treea0e26d9ac0b2b9fb17c5ff337169c609066f0d85
parenta9bfdcaa06b42e9c0de06042f79d1920361aaa25 (diff)
warping works!
-rw-r--r--src/Window.cc28
-rw-r--r--src/Window.hh2
2 files changed, 16 insertions, 14 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 98696a56..835cbdec 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -3065,6 +3065,7 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
assert(flags.moving);
assert(blackbox->getChangingWindow() == this);
+ bool warp = False;
int dx = x_root - frame.grab_x, dy = y_root - frame.grab_y;
dx -= frame.border_w;
dy -= frame.border_w;
@@ -3072,6 +3073,9 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
doWindowSnapping(dx, dy);
if (screen->doOpaqueMove()) {
+ if (screen->doWorkspaceWarping())
+ warp = doWorkspaceWarping(x_root, y_root, dx, dy);
+
configure(dx, dy, frame.rect.width(), frame.rect.height());
} else {
XDrawRectangle(blackbox->getXDisplay(), screen->getRootWindow(),
@@ -3081,6 +3085,9 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
frame.changing.width() - 1,
frame.changing.height() - 1);
+ if (screen->doWorkspaceWarping())
+ warp = doWorkspaceWarping(x_root, y_root, dx, dy);
+
frame.changing.setPos(dx, dy);
XDrawRectangle(blackbox->getXDisplay(), screen->getRootWindow(),
@@ -3091,14 +3098,11 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
frame.changing.height() - 1);
}
- if (screen->doWorkspaceWarping())
- doWorkspaceWarping(x_root, y_root, dx, dy);
-
screen->showPosition(dx, dy);
}
-void BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
+bool BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
int &dx, int dy) {
// workspace warping
bool warp = False;
@@ -3116,9 +3120,7 @@ void BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
else dest = 0;
}
if (! warp)
- return;
-
- endMove();
+ return False;
bool focus = flags.focused; // had focus while moving?
@@ -3135,24 +3137,24 @@ void BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
We grab the X server here so that we dont end up magically grabbing
a different window dring the warp.
*/
- XGrabServer(blackbox->getXDisplay());
if (! flags.stuck)
screen->reassociateWindow(this, dest, False);
screen->changeWorkspaceID(dest);
- configure(dx, dy, frame.rect.width(), frame.rect.height());
-
+ XUngrabPointer(blackbox->getXDisplay(), CurrentTime);
XWarpPointer(blackbox->getXDisplay(), None,
screen->getRootWindow(), 0, 0, 0, 0,
dest_x, y_root);
-
- XUngrabServer(blackbox->getXDisplay());
+ XGrabPointer(blackbox->getXDisplay(), frame.window, False,
+ PointerMotionMask | ButtonReleaseMask,
+ GrabModeAsync, GrabModeAsync,
+ None, blackbox->getMoveCursor(), CurrentTime);
if (focus)
setInputFocus();
- beginMove(dest_x, y_root);
+ return True;
}
diff --git a/src/Window.hh b/src/Window.hh
index 695d3e1c..727f1006 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -296,7 +296,7 @@ private:
void setState(unsigned long new_state);
void upsize(void);
void doMove(int x_root, int y_root);
- void doWorkspaceWarping(int x_root, int y_root, int &dx, int dy);
+ bool doWorkspaceWarping(int x_root, int y_root, int &dx, int dy);
void doWindowSnapping(int &dx, int &dy);
void endMove(void);
void doResize(int x_root, int y_root);