diff --git a/src/movesize.cc b/src/movesize.cc index 3048daf90..fd54e7855 100644 --- a/src/movesize.cc +++ b/src/movesize.cc @@ -832,7 +832,7 @@ bool YFrameWindow::canSize(bool horiz, bool vert) { void YFrameWindow::netMoveSize(int x, int y, int direction) { - if (movingWindow || sizingWindow) { + if (hasMoveSize()) { if (direction == _NET_WM_MOVERESIZE_CANCEL) endMoveSize(); return; @@ -866,6 +866,9 @@ void YFrameWindow::netMoveSize(int x, int y, int direction) void YFrameWindow::startMoveSize(bool doMove, bool byMouse, int sideX, int sideY, int mouseXroot, int mouseYroot) { + if (isMinimized() || isHidden() || isFullscreen() || hasMoveSize()) + return; + Cursor grabPointer = None; grabX = sideX; @@ -1060,7 +1063,7 @@ void YFrameWindow::handleButton(const XButtonEvent &button) { wmRaise(); } } else if (button.type == ButtonRelease) { - if (movingWindow || sizingWindow) { + if (hasMoveSize()) { endMoveSize(); return ; } diff --git a/src/wmframe.cc b/src/wmframe.cc index 779c8dffa..3e4d78cb4 100644 --- a/src/wmframe.cc +++ b/src/wmframe.cc @@ -1931,6 +1931,8 @@ void YFrameWindow::wmCloseClient(YFrameClient* client, bool* confirm) { void YFrameWindow::wmClose() { if (!canClose()) return ; + if (hasMoveSize()) + endMoveSize(); manager->grabServer(); bool confirm = false; @@ -1962,6 +1964,8 @@ void YFrameWindow::wmConfirmKill(const char* message) { void YFrameWindow::wmKill() { if (!canClose()) return ; + if (hasMoveSize()) + endMoveSize(); #ifdef DEBUG if (debug) msg("No WM_DELETE_WINDOW protocol"); @@ -3525,6 +3529,9 @@ void YFrameWindow::setState(int mask, int state) { fWinState, fWinState ^ flip, gain, lose)); fWinState ^= flip; + if (gain & (WinStateUnmapped | WinStateFullscreen | WinStateMaximizedBoth)) + if (hasMoveSize()) + endMoveSize(); if (flip & WinStateMinimized) { MSG(("WinStateMinimized: %d", isMinimized())); if (gain & WinStateMinimized) diff --git a/src/wmframe.h b/src/wmframe.h index 41cd29912..6d2dc3d51 100644 --- a/src/wmframe.h +++ b/src/wmframe.h @@ -131,6 +131,7 @@ class YFrameWindow: void startMoveSize(bool doMove, bool byMouse, int sideX, int sideY, int mouseXroot, int mouseYroot); + bool hasMoveSize() const { return movingWindow || sizingWindow; } void endMoveSize(); void moveWindow(int newX, int newY); void manualPlace();