You can now configure the behavior when dragging a maximized window by setting
DragMaximizedWindow in ~/GNUstep/Defaults/WindowMaker.  The options are:
- Move: Move the window and retain its maximized status and geometry (the
  current behavior and the default).
- RestoreGeometry: Move the window and unmaximize it, restoring its original
  geometry.
- Unmaximize: Move the window and unmaximize it, retaining its maximized
  geometry.
- NoMove: Don't move the window.
---
 src/WindowMaker.h |  9 ++++++++-
 src/actions.c     |  6 ++++++
 src/defaults.c    | 12 ++++++++++--
 src/moveres.c     |  5 +++--
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 30eca95..b3ec656 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -233,6 +233,13 @@ typedef enum {
 #define        WB_TOPBOTTOM    2
 #define        WB_ALLDIRS      (WB_LEFTRIGHT|WB_TOPBOTTOM)
 
+/* drag maximized window behaviors */
+enum {
+       DRAGMAX_MOVE,
+       DRAGMAX_RESTORE,
+       DRAGMAX_UNMAXIMIZE,
+       DRAGMAX_NOMOVE
+};
 
 /* program states */
 typedef enum {
@@ -353,7 +360,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 drag_maximized_window;        /* behavior when a maximized window is 
dragged */
 
     char highlight_active_app;         /* show the focused app by highlighting 
its icon */
     char auto_arrange_icons;          /* automagically arrange icons */
diff --git a/src/actions.c b/src/actions.c
index b8e4fc4..21082cf 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -364,6 +364,9 @@ void wMaximizeWindow(WWindow *wwin, int directions)
        if (!HAS_BORDER(wwin))
                has_border = 0;
 
+       if (wPreferences.drag_maximized_window == DRAGMAX_NOMOVE)
+               wwin->client_flags.no_movable = 1;
+
        /* the size to adjust the geometry */
        adj_size = scr->frame_border_width * 2 * has_border;
 
@@ -681,6 +684,9 @@ void wUnmaximizeWindow(WWindow *wwin)
                wUnshadeWindow(wwin);
        }
 
+       if (wPreferences.drag_maximized_window == DRAGMAX_NOMOVE)
+               wwin->client_flags.no_movable = 0;
+
        /* Use old coordinates if they are set, current values otherwise */
        remember_geometry(wwin, &x, &y, &w, &h);
 
diff --git a/src/defaults.c b/src/defaults.c
index 8dadc21..6ca7f3f 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -309,6 +309,14 @@ static WOptionEnumeration seWorkspaceBorder[] = {
        {NULL, 0, 0}
 };
 
+static WOptionEnumeration seDragMaximizedWindow[] = {
+       {"Move", DRAGMAX_MOVE, 0},
+       {"RestoreGeometry", DRAGMAX_RESTORE, 0},
+       {"Unmaximize", DRAGMAX_UNMAXIMIZE, 0},
+       {"NoMove", DRAGMAX_NOMOVE, 0},
+       {NULL, 0, 0}
+};
+
 /*
  * ALL entries in the tables bellow, NEED to have a default value
  * defined, and this value needs to be correct.
@@ -452,8 +460,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},
+       {"DragMaximizedWindow", "Move", seDragMaximizedWindow,
+           &wPreferences.drag_maximized_window, getEnum, 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 34de9b3..c77a105 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -1724,7 +1724,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
                                   || abs(ev->xmotion.y_root - 
event.xmotion.y_root) >= MOVE_THRESHOLD) {
 
                                if (wwin->flags.maximized) {
-                                       if (wPreferences.unmaximize_on_move) {
+                                       if (wPreferences.drag_maximized_window 
== DRAGMAX_RESTORE) {
                                                float titlebar_ratio;
                                                int new_x, new_y;
 
@@ -1736,7 +1736,8 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
                                                wWindowMove(wwin, new_x, new_y);
                                                moveData.realX = moveData.calcX 
= wwin->frame_x;
                                                moveData.realY = moveData.calcY 
= wwin->frame_y;
-                                       } else {
+                                       }
+                                       if (wPreferences.drag_maximized_window 
== DRAGMAX_UNMAXIMIZE) {
                                                wwin->flags.maximized = 0;
                                                wwin->flags.old_maximized = 0;
                                        }
-- 
1.9.1


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to