1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-21 21:38:00 +01:00

wmaker: Add new options for dragging maximized windows.

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.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
Doug Torrance
2014-09-23 18:44:07 -05:00
committed by Carlos R. Mafra
parent 81e2b42746
commit 9937566ec4
4 changed files with 27 additions and 5 deletions

View File

@@ -233,6 +233,13 @@ typedef enum {
#define WB_TOPBOTTOM 2 #define WB_TOPBOTTOM 2
#define WB_ALLDIRS (WB_LEFTRIGHT|WB_TOPBOTTOM) #define WB_ALLDIRS (WB_LEFTRIGHT|WB_TOPBOTTOM)
/* drag maximized window behaviors */
enum {
DRAGMAX_MOVE,
DRAGMAX_RESTORE,
DRAGMAX_UNMAXIMIZE,
DRAGMAX_NOMOVE
};
/* program states */ /* program states */
typedef enum { typedef enum {
@@ -353,7 +360,7 @@ extern struct WPreferences {
char no_animations; /* enable/disable animations */ char no_animations; /* enable/disable animations */
char no_autowrap; /* wrap workspace when window is moved to the edge */ char no_autowrap; /* wrap workspace when window is moved to the edge */
char window_snapping; /* enable window snapping */ 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 highlight_active_app; /* show the focused app by highlighting its icon */
char auto_arrange_icons; /* automagically arrange icons */ char auto_arrange_icons; /* automagically arrange icons */

View File

@@ -364,6 +364,9 @@ void wMaximizeWindow(WWindow *wwin, int directions)
if (!HAS_BORDER(wwin)) if (!HAS_BORDER(wwin))
has_border = 0; has_border = 0;
if (wPreferences.drag_maximized_window == DRAGMAX_NOMOVE)
wwin->client_flags.no_movable = 1;
/* the size to adjust the geometry */ /* the size to adjust the geometry */
adj_size = scr->frame_border_width * 2 * has_border; adj_size = scr->frame_border_width * 2 * has_border;
@@ -681,6 +684,9 @@ void wUnmaximizeWindow(WWindow *wwin)
wUnshadeWindow(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 */ /* Use old coordinates if they are set, current values otherwise */
remember_geometry(wwin, &x, &y, &w, &h); remember_geometry(wwin, &x, &y, &w, &h);

View File

@@ -309,6 +309,14 @@ static WOptionEnumeration seWorkspaceBorder[] = {
{NULL, 0, 0} {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 * ALL entries in the tables bellow, NEED to have a default value
* defined, and this value needs to be correct. * defined, and this value needs to be correct.
@@ -452,8 +460,8 @@ WDefaultEntry optionList[] = {
&wPreferences.no_autowrap, getBool, NULL, NULL, NULL}, &wPreferences.no_autowrap, getBool, NULL, NULL, NULL},
{"WindowSnapping", "NO", NULL, {"WindowSnapping", "NO", NULL,
&wPreferences.window_snapping, getBool, NULL, NULL, NULL}, &wPreferences.window_snapping, getBool, NULL, NULL, NULL},
{"UnmaximizeOnMove", "NO", NULL, {"DragMaximizedWindow", "Move", seDragMaximizedWindow,
&wPreferences.unmaximize_on_move, getBool, NULL, NULL, NULL}, &wPreferences.drag_maximized_window, getEnum, NULL, NULL, NULL},
{"HighlightActiveApp", "YES", NULL, {"HighlightActiveApp", "YES", NULL,
&wPreferences.highlight_active_app, getBool, NULL, NULL, NULL}, &wPreferences.highlight_active_app, getBool, NULL, NULL, NULL},
{"AutoArrangeIcons", "NO", NULL, {"AutoArrangeIcons", "NO", NULL,

View File

@@ -1724,7 +1724,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
|| abs(ev->xmotion.y_root - event.xmotion.y_root) >= MOVE_THRESHOLD) { || abs(ev->xmotion.y_root - event.xmotion.y_root) >= MOVE_THRESHOLD) {
if (wwin->flags.maximized) { if (wwin->flags.maximized) {
if (wPreferences.unmaximize_on_move) { if (wPreferences.drag_maximized_window == DRAGMAX_RESTORE) {
float titlebar_ratio; float titlebar_ratio;
int new_x, new_y; int new_x, new_y;
@@ -1736,7 +1736,8 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
wWindowMove(wwin, new_x, new_y); wWindowMove(wwin, new_x, new_y);
moveData.realX = moveData.calcX = wwin->frame_x; moveData.realX = moveData.calcX = wwin->frame_x;
moveData.realY = moveData.calcY = wwin->frame_y; moveData.realY = moveData.calcY = wwin->frame_y;
} else { }
if (wPreferences.drag_maximized_window == DRAGMAX_UNMAXIMIZE) {
wwin->flags.maximized = 0; wwin->flags.maximized = 0;
wwin->flags.old_maximized = 0; wwin->flags.old_maximized = 0;
} }