about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2013-12-30 02:20:53 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2013-12-30 02:20:53 +0100
commit5553ea232b276ac454c048f3f9d9548536a69f05 (patch)
tree99d501f30f047955ac32b085f0fe1070b4b0b191
parentb387351df1593020665df5e5ee5d86d16ad8b7d6 (diff)
downloadcwm-cn-noraise.tar.gz
cwm-cn-noraise.tar.xz
cwm-cn-noraise.zip
don't raise windows with the CWM_NORAISE property set cn-noraise
-rw-r--r--calmwm.h2
-rw-r--r--conf.c1
-rw-r--r--xevents.c6
-rw-r--r--xutil.c15
4 files changed, 23 insertions, 1 deletions
diff --git a/calmwm.h b/calmwm.h
index 1e0fb14..8397932 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -349,6 +349,7 @@ enum {
 	_MOTIF_WM_HINTS,
 	UTF8_STRING,
 	WM_CHANGE_STATE,
+        CWM_NORAISE,
 	CWMH_NITEMS
 };
 enum {
@@ -570,6 +571,7 @@ void 			 xu_ewmh_handle_net_wm_state_msg(struct client_ctx *,
 			     int, Atom , Atom);
 void 			 xu_ewmh_set_net_wm_state(struct client_ctx *);
 void 			 xu_ewmh_restore_net_wm_state(struct client_ctx *);
+int			 xu_cwm_allow_raise(struct client_ctx *);
 
 void			 u_exec(char *);
 void			 u_spawn(char *);
diff --git a/conf.c b/conf.c
index 50d1069..8b32b22 100644
--- a/conf.c
+++ b/conf.c
@@ -670,6 +670,7 @@ static char *cwmhints[] = {
 	"_MOTIF_WM_HINTS",
 	"UTF8_STRING",
 	"WM_CHANGE_STATE",
+        "CWM_NORAISE",
 };
 static char *ewmhints[] = {
 	"_NET_SUPPORTED",
diff --git a/xevents.c b/xevents.c
index b1d4c64..7d36244 100644
--- a/xevents.c
+++ b/xevents.c
@@ -154,6 +154,9 @@ xev_handle_configurerequest(XEvent *ee)
 		wc.height = cc->geom.h;
 		wc.border_width = cc->bwidth;
 
+		if (!xu_cwm_allow_raise(cc))
+			e->value_mask &= ~(CWSibling | CWStackMode);
+
 		XConfigureWindow(X_Dpy, cc->win, e->value_mask, &wc);
 		client_config(cc);
 	} else {
@@ -337,7 +340,8 @@ xev_handle_clientmessage(XEvent *ee)
 	if (e->message_type == ewmh[_NET_CLOSE_WINDOW])
 		client_send_delete(cc);
 
-	if (e->message_type == ewmh[_NET_ACTIVE_WINDOW] && e->format == 32) {
+	if (e->message_type == ewmh[_NET_ACTIVE_WINDOW] && e->format == 32 &&
+	    xu_cwm_allow_raise(cc)) {
 		if ((old_cc = client_current()))
 			client_ptrsave(old_cc);
 		client_ptrwarp(cc);
diff --git a/xutil.c b/xutil.c
index bc37558..d3253ad 100644
--- a/xutil.c
+++ b/xutil.c
@@ -414,6 +414,21 @@ xu_ewmh_set_net_wm_state(struct client_ctx *cc)
 	free(atoms);
 }
 
+int
+xu_cwm_allow_raise(struct client_ctx *cc)
+{
+	long	 noraise = 0;
+	long	*noraisep;
+
+	if (xu_getprop(cc->win, cwmh[CWM_NORAISE],
+	    XA_CARDINAL, 1, (unsigned char **)&noraisep) > 0) {
+		noraise = *noraisep;
+		XFree(noraisep);
+	}
+
+	return noraise == 0;
+}
+
 void
 xu_xorcolor(XftColor a, XftColor b, XftColor *r)
 {