From 9de5a27dbc57aac8af8624fdb406f3cc63e5bf39 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 17 Jan 2016 15:47:50 -0500 Subject: [PATCH] wmaker: Add option for window snap to top edge to maximize to full screen. This is a common behavior in a number of other environments, e.g., Unity and Windows. --- NEWS | 15 ++++++++++++++- WPrefs.app/Expert.c | 3 +++ src/WindowMaker.h | 1 + src/defaults.c | 2 ++ src/moveres.c | 10 ++++++++-- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 36fb3f41..4dcacb74 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,20 @@ - NEWS for veteran Window Maker users ----------------------------------- +-- 0.95.8 + + +Snapping a window to the top +---------------------------- + +You can now choose whether snapping a window to the top edge of the screen +maximizes it to the top half (the previous and default behavior) or to the +full screen by setting "SnapToTopMaximizesFullscreen" to "NO" or "YES", +respectively. This setting can also be changed by unchecking or checking +"Snapping a window to the top maximizes it to the full screen" in the +"Expert User Preferences" tab in WPrefs.app. + + -- 0.95.7 Window snapping diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c index 0c5df943..84c2eb51 100644 --- a/WPrefs.app/Expert.c +++ b/WPrefs.app/Expert.c @@ -97,6 +97,9 @@ static const struct { { N_("Distance from corner to begin window snap."), /* default: */ 10, OPTION_WMAKER_INT, "SnapCornerDetect" }, + { N_("Snapping a window to the top maximizes it to the full screen."), + /* default: */ False, OPTION_WMAKER, "SnapToTopMaximizesFullscreen" }, + { N_("Open dialogs in the same workspace as their owners."), /* default: */ False, OPTION_WMAKER, "OpenTransientOnOwnerWorkspace" } diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 21da64da..fe22a79c 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -362,6 +362,7 @@ extern struct WPreferences { char window_snapping; /* enable window snapping */ int snap_edge_detect; /* how far from edge to begin snap */ int snap_corner_detect; /* how far from corner to begin snap */ + char snap_to_top_maximizes_fullscreen; char drag_maximized_window; /* behavior when a maximized window is dragged */ char highlight_active_app; /* show the focused app by highlighting its icon */ diff --git a/src/defaults.c b/src/defaults.c index 0a859caa..ea022955 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -478,6 +478,8 @@ WDefaultEntry optionList[] = { &wPreferences.snap_edge_detect, getInt, NULL, NULL, NULL}, {"SnapCornerDetect", "10", NULL, &wPreferences.snap_corner_detect, getInt, NULL, NULL, NULL}, + {"SnapToTopMaximizesFullscreen", "NO", NULL, + &wPreferences.snap_to_top_maximizes_fullscreen, getBool, NULL, NULL, NULL}, {"DragMaximizedWindow", "Move", seDragMaximizedWindow, &wPreferences.drag_maximized_window, getEnum, NULL, NULL, NULL}, {"HighlightActiveApp", "YES", NULL, diff --git a/src/moveres.c b/src/moveres.c index 5472ceb1..9f7a91de 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -1212,7 +1212,10 @@ static void draw_snap_frame(WWindow *wwin, int direction) break; case SNAP_TOP: - drawTransparentFrame(wwin, 0, 0, scr->scr_width, scr->scr_height/2); + if (wPreferences.snap_to_top_maximizes_fullscreen) + drawTransparentFrame(wwin, 0, 0, scr->scr_width, scr->scr_height); + else + drawTransparentFrame(wwin, 0, 0, scr->scr_width, scr->scr_height/2); break; case SNAP_BOTTOM: @@ -1289,7 +1292,10 @@ static void do_snap(WWindow *wwin, MoveData *data, Bool opaqueMove) directions = MAX_VERTICAL | MAX_RIGHTHALF; break; case SNAP_TOP: - directions = MAX_HORIZONTAL | MAX_TOPHALF; + if (wPreferences.snap_to_top_maximizes_fullscreen) + directions = MAX_HORIZONTAL | MAX_VERTICAL; + else + directions = MAX_HORIZONTAL | MAX_TOPHALF; break; case SNAP_BOTTOM: directions = MAX_HORIZONTAL | MAX_BOTTOMHALF; -- 2.11.4.GIT