[PATCH 1/2] wmaker: Add keyboard shortcuts for keeping window on top or at bottom.

Doug Torrance <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
This closes Debian bug #306808 [1].

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306808
---
 WPrefs.app/KeyboardShortcuts.c |  2 ++
 src/defaults.c                 |  4 ++++
 src/event.c                    | 21 +++++++++++++++++++++
 src/keybind.h                  |  2 ++
 4 files changed, 29 insertions(+)

diff --git a/WPrefs.app/KeyboardShortcuts.c b/WPrefs.app/KeyboardShortcuts.c
index 6984a91..a9241e9 100644
--- a/WPrefs.app/KeyboardShortcuts.c
+++ b/WPrefs.app/KeyboardShortcuts.c
@@ -89,6 +89,8 @@ static const struct {
 	{ "LBCMaximizeKey", N_("Maximize active window left bottom corner") },
 	{ "RBCMaximizeKey", N_("Maximize active window right bottom corner") },
 	{ "MaximusKey",     N_("Maximus: Tiled maximization ") },
+	{ "KeepOnTopKey",   N_("Toggle window on top status") },
+	{ "KeepAtBottomKey",N_("Toggle window at bottom status") },
 	{ "OmnipresentKey", N_("Toggle window omnipresent status") },
 	{ "RaiseKey",       N_("Raise active window") },
 	{ "LowerKey",       N_("Lower active window") },
diff --git a/src/defaults.c b/src/defaults.c
index ea02295..2346817 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -684,6 +684,10 @@ WDefaultEntry optionList[] = {
 		NULL, getKeybind, setKeyGrab, NULL, NULL},
 	{"MaximusKey", "None", (void*)WKBD_MAXIMUS,
 		NULL, getKeybind, setKeyGrab, NULL, NULL},
+	{"KeepOnTopKey", "None", (void *)WKBD_KEEP_ON_TOP,
+	    NULL, getKeybind, setKeyGrab, NULL, NULL},
+	{"KeepAtBottomKey", "None", (void *)WKBD_KEEP_AT_BOTTOM,
+	    NULL, getKeybind, setKeyGrab, NULL, NULL},
 	{"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT,
 	    NULL, getKeybind, setKeyGrab, NULL, NULL},
 	{"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE,
diff --git a/src/event.c b/src/event.c
index 800cc87..0b394e7 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1564,6 +1564,27 @@ static void handleKeyPress(XEvent * event)
 			handleMaximize(wwin, MAX_MAXIMUS | MAX_KEYBOARD);
 		}
 		break;
+	case WKBD_KEEP_ON_TOP:
+		if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
+			CloseWindowMenu(scr);
+
+			if (wwin->frame->core->stacking->window_level != WMFloatingLevel)
+				ChangeStackingLevel(wwin->frame->core, WMFloatingLevel);
+			else
+				ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
+		}
+		break;
+
+	case WKBD_KEEP_AT_BOTTOM:
+		if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
+			CloseWindowMenu(scr);
+
+			if (wwin->frame->core->stacking->window_level != WMSunkenLevel)
+				ChangeStackingLevel(wwin->frame->core, WMSunkenLevel);
+			else
+				ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
+		}
+		break;
 	case WKBD_OMNIPRESENT:
 		if (ISMAPPED(wwin) && ISFOCUSED(wwin)) {
 			CloseWindowMenu(scr);
diff --git a/src/keybind.h b/src/keybind.h
index 87a5cdc..214fd91 100644
--- a/src/keybind.h
+++ b/src/keybind.h
@@ -63,6 +63,8 @@ enum {
 	WKBD_RBCMAXIMIZE,
 	WKBD_MAXIMUS,
 	WKBD_SELECT,
+	WKBD_KEEP_ON_TOP,
+	WKBD_KEEP_AT_BOTTOM,
 	WKBD_OMNIPRESENT,
 	WKBD_RAISE,
 	WKBD_LOWER,
-- 
2.5.0


-- 
To unsubscribe, send mail to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.