mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
More intuitive maximization handling.
Avoid some pitfalls with window maximization and make it behave more intuitively. We now treat a window's vertical and horizontal maximization as separate properties and only remember its original geometry in a particular direction when it actually changes. We also deliberately do not remember a window's geometry when it changes from one maximized state to another. As a result windows can be more reliably restored to their original size. For example the "Maximize active window" hotkey followed by the "Maximize active window vertically" hotkey will now result in the window being maximized horizontally only, whereas previously the second hotkey would have no effect because the window was already maximized vertically. In addition selecting the Unmaximize window menu in the same example will now result in the window being restored to its original size. Previously the unmaximize attempt would have no effect because the vertical maximization would have remembered the window's "original" geometry when it was fully maximized. Maximus is handled separately. The "Maximus" hotkey will now toggle Maximus mode regardless of the window's current maximization state. For example if two unmaximized windows are on screen and one is Maximusized it will fill the space left by the second window, as before. But if the first window is maximized and the "Maximus" hotkey is pressed the window will now fill the same space as if it were Maximusized from its original size. Previously the window would not change size from its fully maximized state because the Maximus algorithm would consider fully-maximized to be a valid Maximus size.
This commit is contained in:
committed by
Carlos R. Mafra
parent
e6e3e1aa49
commit
aee0ad45f2
30
src/event.c
30
src/event.c
@@ -1444,60 +1444,42 @@ static void handleKeyPress(XEvent * event)
|
||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||
CloseWindowMenu(scr);
|
||||
|
||||
if (wwin->flags.maximized == (MAX_VERTICAL | MAX_HORIZONTAL))
|
||||
wUnmaximizeWindow(wwin);
|
||||
else
|
||||
wMaximizeWindow(wwin, MAX_VERTICAL | MAX_HORIZONTAL | MAX_KEYBOARD);
|
||||
handleMaximize(wwin, MAX_VERTICAL | MAX_HORIZONTAL | MAX_KEYBOARD);
|
||||
}
|
||||
break;
|
||||
case WKBD_VMAXIMIZE:
|
||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||
CloseWindowMenu(scr);
|
||||
|
||||
if (wwin->flags.maximized == MAX_VERTICAL)
|
||||
wUnmaximizeWindow(wwin);
|
||||
else
|
||||
wMaximizeWindow(wwin, MAX_VERTICAL | MAX_KEYBOARD);
|
||||
handleMaximize(wwin, MAX_VERTICAL | MAX_KEYBOARD);
|
||||
}
|
||||
break;
|
||||
case WKBD_HMAXIMIZE:
|
||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||
CloseWindowMenu(scr);
|
||||
|
||||
if (wwin->flags.maximized == MAX_HORIZONTAL)
|
||||
wUnmaximizeWindow(wwin);
|
||||
else
|
||||
wMaximizeWindow(wwin, MAX_HORIZONTAL | MAX_KEYBOARD);
|
||||
handleMaximize(wwin, MAX_HORIZONTAL | MAX_KEYBOARD);
|
||||
}
|
||||
break;
|
||||
case WKBD_LHMAXIMIZE:
|
||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||
CloseWindowMenu(scr);
|
||||
|
||||
if (wwin->flags.maximized == (MAX_VERTICAL | MAX_LEFTHALF))
|
||||
wUnmaximizeWindow(wwin);
|
||||
else
|
||||
wMaximizeWindow(wwin, MAX_VERTICAL | MAX_LEFTHALF | MAX_KEYBOARD);
|
||||
handleMaximize(wwin, MAX_VERTICAL | MAX_LEFTHALF | MAX_KEYBOARD);
|
||||
}
|
||||
break;
|
||||
case WKBD_RHMAXIMIZE:
|
||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||
CloseWindowMenu(scr);
|
||||
|
||||
if (wwin->flags.maximized == (MAX_VERTICAL | MAX_RIGHTHALF))
|
||||
wUnmaximizeWindow(wwin);
|
||||
else
|
||||
wMaximizeWindow(wwin, MAX_VERTICAL | MAX_RIGHTHALF | MAX_KEYBOARD);
|
||||
handleMaximize(wwin, MAX_VERTICAL | MAX_RIGHTHALF | MAX_KEYBOARD);
|
||||
}
|
||||
break;
|
||||
case WKBD_MAXIMUS:
|
||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||
CloseWindowMenu(scr);
|
||||
|
||||
if (wwin->flags.maximized == MAX_MAXIMUS)
|
||||
wUnmaximizeWindow(wwin);
|
||||
else
|
||||
wMaximizeWindow(wwin, MAX_MAXIMUS | MAX_KEYBOARD);
|
||||
handleMaximize(wwin, MAX_MAXIMUS | MAX_KEYBOARD);
|
||||
}
|
||||
break;
|
||||
case WKBD_RAISE:
|
||||
|
||||
Reference in New Issue
Block a user