If a user moves a window which is currently maximized, the current behavior is
to keep the window geometry and maximized status unchanged. This can lead to
peculiar behavior. For example, suppose a user maximizes a window to the
right half of the screen (either through the window menu, keyboard shortcut, or
new snapping feature), then moves it, and then attempts maximize it to the
right half of the screen again. Instead of the expected result, the window is
unmaximized and returned to its original geometry.
This patch changes the behavior by unmaximizing any maximized window which is
moved. This is consistent with other desktop environments, e.g., GNOME, Unity,
and Windows.
---
src/moveres.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/moveres.c b/src/moveres.c
index 6899a86..e05d3be 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -1723,6 +1723,20 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
} else if (abs(ev->xmotion.x_root -
event.xmotion.x_root) >= MOVE_THRESHOLD
|| abs(ev->xmotion.y_root -
event.xmotion.y_root) >= MOVE_THRESHOLD) {
+ if (wwin->flags.maximized) {
+ float titlebar_ratio;
+ int new_x, new_y;
+
+ titlebar_ratio = (moveData.mouseX -
wwin->frame_x) /
+ (float)wwin->frame->core->width;
+ new_y = wwin->frame_y;
+ wUnmaximizeWindow(wwin);
+ new_x = moveData.mouseX -
titlebar_ratio * wwin->frame->core->width;
+ wWindowMove(wwin, new_x, new_y);
+ moveData.realX = moveData.calcX =
wwin->frame_x;
+ moveData.realY = moveData.calcY =
wwin->frame_y;
+ }
+
XChangeActivePointerGrab(dpy, ButtonMotionMask
| ButtonReleaseMask |
ButtonPressMask,
wPreferences.cursor[WCUR_MOVE], CurrentTime);
--
1.9.1
--
To unsubscribe, send mail to [email protected].