1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

Added possibility for half-maximized windows to move across the screens.

Using MoveHalfMaximizedWindowsBetweenScreens option user can enable
ability for moving half-maximized windows not only within current
screen/head/display, but also to other heads, if they exists. Note, that
only vertically or horizontally maximized windows can be transfered to
another display. Quarter-maximized windows are not supported, since it
is ambiguous to predict in which direction such window should be moved.
This commit is contained in:
2017-02-07 21:05:17 +01:00
committed by Carlos R. Mafra
parent 17a47af160
commit 28da4c98e3
2 changed files with 133 additions and 1 deletions

86
NEWS
View File

@@ -15,6 +15,92 @@ respectively. This setting can also be changed by unchecking or checking
"Expert User Preferences" tab in WPrefs.app.
Move half-maximized windows between the screens
-----------------------------------------------
New option was introduced to allow change of behaviour of half-maximize windows
in multiple displays environment. In such environment it is more natural that
half maximized windows would travel from one screen to another. Now it is
possible to make that happen by setting an option
"MoveHalfMaximizedWindowsBetweenScreens" to "Yes" in
~/GNUstep/Defaults/WindowMaker config file, or by checking "Allow move
half-maximized windows between multiple screens." in 'Expert User Preferences"
tab in WPrefs.app.
For example, given there are two screens in layout where one display is on the
left and second display is on the right with window on first screen:
┌┬────────────────┬─────────────────┬┐
├┘ ┌───────┐ │ ├┤
│ ├───────┤ │ ├┤
│ │ │ │ ├┤
│ │ │ │ ├┤
│ └───────┘ │ └┤
├┬┐ ├┬┬┐ │
└┴┴───────────────┴┴┴┴───────────────┘
It can be right-half-maximized (using previously defined key combination), so it
become:
┌┬───────┬────────┬─────────────────┬┐
├┘ ├────────┤ ├┤
│ │ │ ├┤
│ │ │ ├┤
│ │ │ ├┤
│ │ │ └┤
├┬┐ └────────┼┬┬┐ │
└┴┴───────────────┴┴┴┴───────────────┘
In this example there is an assumption that WindowMaker is configured, that
maximized windows wont cover mini icons nor dock.
Without setting new option to true, issuing another right-half-maximize will
restore window dimensions and position to the original state (like on the first
figure). With new option set to true it will move window to second screen like:
┌┬────────────────┬────────┬────────┬┐
├┘ ├────────┤ ├┤
│ │ │ ├┤
│ │ │ ├┤
│ │ │ ├┤
│ │ │ └┤
├┬┐ ├┬┬┬─────┘ │
└┴┴───────────────┴┴┴┴───────────────┘
Another activation of right-half-maxmimize:
┌┬────────────────┬────────┬────────┬┐
├┘ │ ├────────┼┤
│ │ │ ├┤
│ │ │ ├┤
│ │ │ ├┤
│ │ │ ├┤
├┬┐ ├┬┬┐ └────────┘│
└┴┴───────────────┴┴┴┴───────────────┘
And final activation of right-half-maxmimize:
┌┬────────────────┬───────┬─────────┬┐
├┘ ├───────┤ ├┤
│ │ │ ├┤
│ │ │ ├┤
│ ├───────┘ ├┤
│ │ └┤
├┬┐ ├┬┬┐ │
└┴┴───────────────┴┴┴┴───────────────┘
Where window is restored its size (but not position, since it it on different
head now). Moving window in directions like left-half-maximize,
top-half-maximize and bottom-half-maximize will behave in similar way depending
on the layout of displays.
Note, that only windows that are half-maximized vertically or horizontally can
be moved to another screen due to the fact, that direction of movement of
quarter-maximized windows is ambiguous. As for vertical/horizontal-maximize,
since doesn't move the window but only strech it vertically/horizontally this
feature also doesn't apply.
-- 0.95.7
Window snapping

View File

@@ -496,7 +496,53 @@ void handleMaximize(WWindow *wwin, int directions)
if ((wwin->flags.old_maximized & MAX_MAXIMUS) &&
!(requested & MAX_MAXIMUS))
wMaximizeWindow(wwin, MAX_MAXIMUS | flags, head);
else
else if (wPreferences.move_half_max_between_heads) {
/* Select windows, which are only horizontally or vertically
* maximized. Quarters cannot be handled here, since there is not
* clear on which direction user intend to move such window. */
if ((current & MAX_VERTICAL) || (current & MAX_HORIZONTAL)) {
if (requested & MAX_LEFTHALF && current & MAX_LEFTHALF) {
head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr,
head, DIRECTION_LEFT);
if (head != -1) {
effective |= MAX_RIGHTHALF;
effective |= MAX_VERTICAL;
effective &= ~(MAX_HORIZONTAL | MAX_LEFTHALF);
}
} else if (requested & MAX_RIGHTHALF &&
current & MAX_RIGHTHALF) {
head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr,
head, DIRECTION_RIGHT);
if (head != -1) {
effective |= MAX_LEFTHALF;
effective |= MAX_VERTICAL;
effective &= ~(MAX_HORIZONTAL | MAX_RIGHTHALF);
}
} else if (requested & MAX_TOPHALF && current & MAX_TOPHALF) {
head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr,
head, DIRECTION_UP);
if (head != -1) {
effective |= MAX_BOTTOMHALF;
effective |= MAX_HORIZONTAL;
effective &= ~(MAX_VERTICAL | MAX_TOPHALF);
}
} else if (requested & MAX_BOTTOMHALF &&
current & MAX_BOTTOMHALF) {
head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr,
head, DIRECTION_DOWN);
if (head != -1) {
effective |= MAX_TOPHALF;
effective |= MAX_HORIZONTAL;
effective &= ~(MAX_VERTICAL | MAX_BOTTOMHALF);
}
} if (head == -1)
wUnmaximizeWindow(wwin);
else
wMaximizeWindow(wwin, effective | flags, head);
} else
wUnmaximizeWindow(wwin);
} else
wUnmaximizeWindow(wwin);
/* these alone mean vertical|horizontal toggle */
} else if ((effective == MAX_LEFTHALF) ||