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

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.
This commit is contained in:
Doug Torrance
2016-01-17 15:47:50 -05:00
committed by Carlos R. Mafra
parent 42e4069541
commit 9de5a27dbc
5 changed files with 28 additions and 3 deletions

View File

@@ -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 */

View File

@@ -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,

View File

@@ -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;