diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 6f39f6b7..982d84c6 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 b8e4fc4e..21082cfe 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 8dadc212..6ca7f3f7 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 34de9b35..c77a1058 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; }