mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
Left Half / Right Half Maximize
This adds Left Half / Right Half Maximize capability to WindowMaker. It allows you to maximize a window to only the left or right half of your screen. It is useful on widescreen displays where one might to bring up two different windows side-by-side.
This commit is contained in:
committed by
Carlos R. Mafra
parent
328251c68a
commit
6924454836
@@ -72,6 +72,8 @@ static char *keyOptions[] = {
|
|||||||
"MaximizeKey",
|
"MaximizeKey",
|
||||||
"VMaximizeKey",
|
"VMaximizeKey",
|
||||||
"HMaximizeKey",
|
"HMaximizeKey",
|
||||||
|
"LHMaximizeKey",
|
||||||
|
"RHMaximizeKey",
|
||||||
"RaiseKey",
|
"RaiseKey",
|
||||||
"LowerKey",
|
"LowerKey",
|
||||||
"RaiseLowerKey",
|
"RaiseLowerKey",
|
||||||
@@ -473,6 +475,8 @@ static void createPanel(Panel * p)
|
|||||||
WMAddListItem(panel->actLs, _("Maximize active window"));
|
WMAddListItem(panel->actLs, _("Maximize active window"));
|
||||||
WMAddListItem(panel->actLs, _("Maximize active window vertically"));
|
WMAddListItem(panel->actLs, _("Maximize active window vertically"));
|
||||||
WMAddListItem(panel->actLs, _("Maximize active window horizontally"));
|
WMAddListItem(panel->actLs, _("Maximize active window horizontally"));
|
||||||
|
WMAddListItem(panel->actLs, _("Maximize active window left half"));
|
||||||
|
WMAddListItem(panel->actLs, _("Maximize active window right half"));
|
||||||
WMAddListItem(panel->actLs, _("Raise active window"));
|
WMAddListItem(panel->actLs, _("Raise active window"));
|
||||||
WMAddListItem(panel->actLs, _("Lower active window"));
|
WMAddListItem(panel->actLs, _("Lower active window"));
|
||||||
WMAddListItem(panel->actLs, _("Raise/Lower window under mouse pointer"));
|
WMAddListItem(panel->actLs, _("Raise/Lower window under mouse pointer"));
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ void wMaximizeWindow(WWindow * wwin, int directions)
|
|||||||
wUnshadeWindow(wwin);
|
wUnshadeWindow(wwin);
|
||||||
}
|
}
|
||||||
/* Only save directions, not kbd or xinerama hints */
|
/* Only save directions, not kbd or xinerama hints */
|
||||||
directions &= (MAX_HORIZONTAL | MAX_VERTICAL);
|
directions &= (MAX_HORIZONTAL|MAX_VERTICAL|MAX_LEFTHALF|MAX_RIGHTHALF);
|
||||||
|
|
||||||
changed_h = ((wwin->flags.maximized ^ directions) & MAX_HORIZONTAL);
|
changed_h = ((wwin->flags.maximized ^ directions) & MAX_HORIZONTAL);
|
||||||
changed_v = ((wwin->flags.maximized ^ directions) & MAX_VERTICAL);
|
changed_v = ((wwin->flags.maximized ^ directions) & MAX_VERTICAL);
|
||||||
@@ -407,7 +407,7 @@ void wMaximizeWindow(WWindow * wwin, int directions)
|
|||||||
* allow succesive maximizations in different directions without
|
* allow succesive maximizations in different directions without
|
||||||
* the need to first do an un-maximize (to avoid flicker).
|
* the need to first do an un-maximize (to avoid flicker).
|
||||||
*/
|
*/
|
||||||
if (!(wwin->flags.maximized & MAX_HORIZONTAL)) {
|
if (!(wwin->flags.maximized & (MAX_HORIZONTAL|MAX_LEFTHALF|MAX_RIGHTHALF))) {
|
||||||
wwin->old_geometry.x = wwin->frame_x;
|
wwin->old_geometry.x = wwin->frame_x;
|
||||||
}
|
}
|
||||||
if (!(wwin->flags.maximized & MAX_VERTICAL)) {
|
if (!(wwin->flags.maximized & MAX_VERTICAL)) {
|
||||||
@@ -426,6 +426,16 @@ void wMaximizeWindow(WWindow * wwin, int directions)
|
|||||||
if (HAS_BORDER(wwin))
|
if (HAS_BORDER(wwin))
|
||||||
new_width -= FRAME_BORDER_WIDTH * 2;
|
new_width -= FRAME_BORDER_WIDTH * 2;
|
||||||
new_x = usableArea.x1;
|
new_x = usableArea.x1;
|
||||||
|
} else if (directions & MAX_LEFTHALF) {
|
||||||
|
new_width = (usableArea.x2 - usableArea.x1)/2;
|
||||||
|
if (HAS_BORDER(wwin))
|
||||||
|
new_width -= FRAME_BORDER_WIDTH * 2;
|
||||||
|
new_x = usableArea.x1;
|
||||||
|
} else if (directions & MAX_RIGHTHALF) {
|
||||||
|
new_width = (usableArea.x2 - usableArea.x1)/2;
|
||||||
|
if (HAS_BORDER(wwin))
|
||||||
|
new_width -= FRAME_BORDER_WIDTH * 2;
|
||||||
|
new_x = usableArea.x1+((usableArea.x2 - usableArea.x1)/2);
|
||||||
} else if (shrink_h) {
|
} else if (shrink_h) {
|
||||||
new_x = wwin->old_geometry.x;
|
new_x = wwin->old_geometry.x;
|
||||||
new_width = wwin->old_geometry.width;
|
new_width = wwin->old_geometry.width;
|
||||||
@@ -478,7 +488,7 @@ void wUnmaximizeWindow(WWindow * wwin)
|
|||||||
wwin->flags.skip_next_animation = 1;
|
wwin->flags.skip_next_animation = 1;
|
||||||
wUnshadeWindow(wwin);
|
wUnshadeWindow(wwin);
|
||||||
}
|
}
|
||||||
x = ((wwin->flags.maximized & MAX_HORIZONTAL) && wwin->old_geometry.x) ?
|
x = ((wwin->flags.maximized & (MAX_HORIZONTAL|MAX_LEFTHALF|MAX_RIGHTHALF)) && wwin->old_geometry.x) ?
|
||||||
wwin->old_geometry.x : wwin->frame_x;
|
wwin->old_geometry.x : wwin->frame_x;
|
||||||
y = ((wwin->flags.maximized & MAX_VERTICAL) && wwin->old_geometry.y) ?
|
y = ((wwin->flags.maximized & MAX_VERTICAL) && wwin->old_geometry.y) ?
|
||||||
wwin->old_geometry.y : wwin->frame_y;
|
wwin->old_geometry.y : wwin->frame_y;
|
||||||
|
|||||||
@@ -26,8 +26,10 @@
|
|||||||
|
|
||||||
#define MAX_HORIZONTAL 1
|
#define MAX_HORIZONTAL 1
|
||||||
#define MAX_VERTICAL 2
|
#define MAX_VERTICAL 2
|
||||||
#define MAX_IGNORE_XINERAMA 4
|
#define MAX_LEFTHALF 4
|
||||||
#define MAX_KEYBOARD 8
|
#define MAX_RIGHTHALF 8
|
||||||
|
#define MAX_IGNORE_XINERAMA 16
|
||||||
|
#define MAX_KEYBOARD 32
|
||||||
|
|
||||||
void wSetFocusTo(WScreen *scr, WWindow *wwin);
|
void wSetFocusTo(WScreen *scr, WWindow *wwin);
|
||||||
|
|
||||||
|
|||||||
@@ -579,6 +579,10 @@ WDefaultEntry optionList[] = {
|
|||||||
NULL, getKeybind, setKeyGrab},
|
NULL, getKeybind, setKeyGrab},
|
||||||
{"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE,
|
{"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE,
|
||||||
NULL, getKeybind, setKeyGrab},
|
NULL, getKeybind, setKeyGrab},
|
||||||
|
{"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE,
|
||||||
|
NULL, getKeybind, setKeyGrab},
|
||||||
|
{"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE,
|
||||||
|
NULL, getKeybind, setKeyGrab},
|
||||||
{"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE,
|
{"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE,
|
||||||
NULL, getKeybind, setKeyGrab},
|
NULL, getKeybind, setKeyGrab},
|
||||||
{"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER,
|
{"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER,
|
||||||
|
|||||||
26
src/event.c
26
src/event.c
@@ -1471,6 +1471,32 @@ static void handleKeyPress(XEvent * event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WKBD_LHMAXIMIZE:
|
||||||
|
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||||
|
int newdir = (MAX_VERTICAL|MAX_LEFTHALF);
|
||||||
|
|
||||||
|
CloseWindowMenu(scr);
|
||||||
|
|
||||||
|
if (wwin->flags.maximized == newdir) {
|
||||||
|
wUnmaximizeWindow(wwin);
|
||||||
|
} else {
|
||||||
|
wMaximizeWindow(wwin, newdir|MAX_KEYBOARD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WKBD_RHMAXIMIZE:
|
||||||
|
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
|
||||||
|
int newdir = (MAX_VERTICAL|MAX_RIGHTHALF);
|
||||||
|
|
||||||
|
CloseWindowMenu(scr);
|
||||||
|
|
||||||
|
if (wwin->flags.maximized == newdir) {
|
||||||
|
wUnmaximizeWindow(wwin);
|
||||||
|
} else {
|
||||||
|
wMaximizeWindow(wwin, newdir|MAX_KEYBOARD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case WKBD_RAISE:
|
case WKBD_RAISE:
|
||||||
if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||||
CloseWindowMenu(scr);
|
CloseWindowMenu(scr);
|
||||||
|
|||||||
@@ -32,57 +32,59 @@
|
|||||||
#define WKBD_MAXIMIZE 6
|
#define WKBD_MAXIMIZE 6
|
||||||
#define WKBD_VMAXIMIZE 7
|
#define WKBD_VMAXIMIZE 7
|
||||||
#define WKBD_HMAXIMIZE 8
|
#define WKBD_HMAXIMIZE 8
|
||||||
#define WKBD_SELECT 9
|
#define WKBD_LHMAXIMIZE 9
|
||||||
|
#define WKBD_RHMAXIMIZE 10
|
||||||
|
#define WKBD_SELECT 11
|
||||||
/* Clip */
|
/* Clip */
|
||||||
#define WKBD_CLIPLOWER 10
|
#define WKBD_CLIPLOWER 12
|
||||||
#define WKBD_CLIPRAISE 11
|
#define WKBD_CLIPRAISE 13
|
||||||
#define WKBD_CLIPRAISELOWER 12
|
#define WKBD_CLIPRAISELOWER 14
|
||||||
/* window */
|
/* window */
|
||||||
#define WKBD_RAISE 13
|
#define WKBD_RAISE 15
|
||||||
#define WKBD_LOWER 14
|
#define WKBD_LOWER 16
|
||||||
#define WKBD_RAISELOWER 15
|
#define WKBD_RAISELOWER 17
|
||||||
#define WKBD_MOVERESIZE 16
|
#define WKBD_MOVERESIZE 18
|
||||||
#define WKBD_SHADE 17
|
#define WKBD_SHADE 19
|
||||||
/* window, menu */
|
/* window, menu */
|
||||||
#define WKBD_CLOSE 18
|
#define WKBD_CLOSE 20
|
||||||
/* window */
|
/* window */
|
||||||
#define WKBD_FOCUSNEXT 19
|
#define WKBD_FOCUSNEXT 21
|
||||||
#define WKBD_FOCUSPREV 20
|
#define WKBD_FOCUSPREV 22
|
||||||
|
|
||||||
#define WKBD_WORKSPACE1 21
|
#define WKBD_WORKSPACE1 23
|
||||||
#define WKBD_WORKSPACE2 22
|
#define WKBD_WORKSPACE2 24
|
||||||
#define WKBD_WORKSPACE3 23
|
#define WKBD_WORKSPACE3 25
|
||||||
#define WKBD_WORKSPACE4 24
|
#define WKBD_WORKSPACE4 26
|
||||||
#define WKBD_WORKSPACE5 25
|
#define WKBD_WORKSPACE5 27
|
||||||
#define WKBD_WORKSPACE6 26
|
#define WKBD_WORKSPACE6 28
|
||||||
#define WKBD_WORKSPACE7 27
|
#define WKBD_WORKSPACE7 29
|
||||||
#define WKBD_WORKSPACE8 28
|
#define WKBD_WORKSPACE8 30
|
||||||
#define WKBD_WORKSPACE9 29
|
#define WKBD_WORKSPACE9 31
|
||||||
#define WKBD_WORKSPACE10 30
|
#define WKBD_WORKSPACE10 32
|
||||||
#define WKBD_NEXTWORKSPACE 31
|
#define WKBD_NEXTWORKSPACE 33
|
||||||
#define WKBD_PREVWORKSPACE 32
|
#define WKBD_PREVWORKSPACE 34
|
||||||
#define WKBD_NEXTWSLAYER 33
|
#define WKBD_NEXTWSLAYER 35
|
||||||
#define WKBD_PREVWSLAYER 34
|
#define WKBD_PREVWSLAYER 36
|
||||||
|
|
||||||
/* window shortcuts */
|
/* window shortcuts */
|
||||||
#define WKBD_WINDOW1 35
|
#define WKBD_WINDOW1 37
|
||||||
#define WKBD_WINDOW2 36
|
#define WKBD_WINDOW2 38
|
||||||
#define WKBD_WINDOW3 37
|
#define WKBD_WINDOW3 39
|
||||||
#define WKBD_WINDOW4 38
|
#define WKBD_WINDOW4 40
|
||||||
#define WKBD_WINDOW5 39
|
#define WKBD_WINDOW5 41
|
||||||
#define WKBD_WINDOW6 40
|
#define WKBD_WINDOW6 42
|
||||||
#define WKBD_WINDOW7 41
|
#define WKBD_WINDOW7 43
|
||||||
#define WKBD_WINDOW8 42
|
#define WKBD_WINDOW8 44
|
||||||
#define WKBD_WINDOW9 43
|
#define WKBD_WINDOW9 45
|
||||||
#define WKBD_WINDOW10 44
|
#define WKBD_WINDOW10 46
|
||||||
|
|
||||||
#define WKBD_SWITCH_SCREEN 45
|
#define WKBD_SWITCH_SCREEN 47
|
||||||
|
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
# define WKBD_TOGGLE 46
|
# define WKBD_TOGGLE 48
|
||||||
# define WKBD_TMP 47
|
# define WKBD_TMP 49
|
||||||
#else
|
#else
|
||||||
# define WKBD_TMP 46
|
# define WKBD_TMP 48
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ typedef struct WWindow {
|
|||||||
unsigned int miniaturized:1;
|
unsigned int miniaturized:1;
|
||||||
unsigned int hidden:1;
|
unsigned int hidden:1;
|
||||||
unsigned int shaded:1;
|
unsigned int shaded:1;
|
||||||
unsigned int maximized:2;
|
unsigned int maximized:4;
|
||||||
unsigned int fullscreen:1;
|
unsigned int fullscreen:1;
|
||||||
unsigned int omnipresent:1;
|
unsigned int omnipresent:1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user