This patch adds the ability to completely unmaximize, i.e., clear the maximized
flag and return to the original geometry, a maximized window that is moved.
This behavior mirrors that of other common desktop enviroments, e.g., GNOME,
Unity, and Windows.
To enable this feature, set "UnmaximizeOnMove = YES" in
~/GNUstep/Defaults/WindowMaker.
---
src/WindowMaker.h | 1 +
src/defaults.c | 2 ++
src/moveres.c | 18 ++++++++++++++++--
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index a93a64d..30eca95 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -353,6 +353,7 @@ extern struct WPreferences {
char no_animations; /* enable/disable animations */
char no_autowrap; /* wrap workspace when window is moved
to the edge */
char window_snapping; /* enable window snapping */
+ char unmaximize_on_move; /* unmaximize a maximized window when
it is moved */
char highlight_active_app; /* show the focused app by highlighting
its icon */
char auto_arrange_icons; /* automagically arrange icons */
diff --git a/src/defaults.c b/src/defaults.c
index 7349443..8dadc21 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -452,6 +452,8 @@ WDefaultEntry optionList[] = {
&wPreferences.no_autowrap, getBool, NULL, NULL, NULL},
{"WindowSnapping", "NO", NULL,
&wPreferences.window_snapping, getBool, NULL, NULL, NULL},
+ {"UnmaximizeOnMove", "NO", NULL,
+ &wPreferences.unmaximize_on_move, getBool, NULL, NULL, NULL},
{"HighlightActiveApp", "YES", NULL,
&wPreferences.highlight_active_app, getBool, NULL, NULL, NULL},
{"AutoArrangeIcons", "NO", NULL,
diff --git a/src/moveres.c b/src/moveres.c
index 64dc50c..34de9b3 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -1724,8 +1724,22 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
|| abs(ev->xmotion.y_root -
event.xmotion.y_root) >= MOVE_THRESHOLD) {
if (wwin->flags.maximized) {
- wwin->flags.maximized = 0;
- wwin->flags.old_maximized = 0;
+ if (wPreferences.unmaximize_on_move) {
+ 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;
+ } else {
+ wwin->flags.maximized = 0;
+ wwin->flags.old_maximized = 0;
+ }
}
XChangeActivePointerGrab(dpy, ButtonMotionMask
--
1.9.1
--
To unsubscribe, send mail to [email protected].