about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2013-12-30 02:41:33 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2013-12-30 02:41:33 +0100
commitf15a7028eb906c2c3be5a48b9c8c3fe97a8a9b02 (patch)
tree273c9992d2050372b497168552b6a2659d702032
parentb387351df1593020665df5e5ee5d86d16ad8b7d6 (diff)
downloadcwm-cn-noraise-global.tar.gz
cwm-cn-noraise-global.tar.xz
cwm-cn-noraise-global.zip
Add acceptraise to specify whether applications can activate and raise windows. cn-noraise-global
Greetings from 30C3.
-rw-r--r--calmwm.h1
-rw-r--r--conf.c1
-rw-r--r--cwmrc.58
-rw-r--r--parse.y9
-rw-r--r--xevents.c6
5 files changed, 23 insertions, 2 deletions
diff --git a/calmwm.h b/calmwm.h
index 1e0fb14..9d5583e 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -304,6 +304,7 @@ struct conf {
 	struct cmd_q		 cmdq;
 	struct mousebinding_q	 mousebindingq;
 #define	CONF_STICKY_GROUPS		0x0001
+#define	CONF_ACCEPT_RAISE		0x0002
 	int			 flags;
 #define CONF_BWIDTH			1
 	int			 bwidth;
diff --git a/conf.c b/conf.c
index 50d1069..2aae13a 100644
--- a/conf.c
+++ b/conf.c
@@ -228,6 +228,7 @@ conf_init(struct conf *c)
 
 	(void)memset(c, 0, sizeof(*c));
 
+        c->flags = CONF_ACCEPT_RAISE;
 	c->bwidth = CONF_BWIDTH;
 	c->mamount = CONF_MAMOUNT;
 	c->snapdist = CONF_SNAPDIST;
diff --git a/cwmrc.5 b/cwmrc.5
index 0b28ed5..ccc27f4 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -39,6 +39,14 @@ Arguments containing whitespace should be surrounded by double quotes
 The following options are accepted:
 .Pp
 .Bl -tag -width Ds -compact
+.It Ic acceptraise Ic yes Ns \&| Ns Ic no
+Toggle whether windows can be raised from applications.
+The default behavior is to allow this.
+By disabling acceptraise,
+.Xr cwm 1
+will ignore requests for window activation and window raising
+from applications.
+.Pp
 .It Ic autogroup Ar group windowclass
 .It Ic autogroup Ar group windowname,windowclass
 Automatically add new windows to
diff --git a/parse.y b/parse.y
index c7a802a..3973f87 100644
--- a/parse.y
+++ b/parse.y
@@ -71,7 +71,7 @@ typedef struct {
 %token	FONTNAME STICKY GAP MOUSEBIND
 %token	AUTOGROUP BIND COMMAND IGNORE
 %token	YES NO BORDERWIDTH MOVEAMOUNT
-%token	COLOR SNAPDIST
+%token	COLOR SNAPDIST ACCEPTRAISE
 %token	ACTIVEBORDER INACTIVEBORDER URGENCYBORDER
 %token	GROUPBORDER UNGROUPBORDER
 %token	MENUBG MENUFG
@@ -117,6 +117,12 @@ main		: FONTNAME STRING		{
 			else
 				conf->flags |= CONF_STICKY_GROUPS;
 		}
+		| ACCEPTRAISE yesno {
+			if ($2 == 0)
+				conf->flags &= ~CONF_ACCEPT_RAISE;
+			else
+				conf->flags |= CONF_ACCEPT_RAISE;
+		}
 		| BORDERWIDTH NUMBER {
 			if ($2 < 0) {
 				yyerror("invalid borderwidth: %d", $2);
@@ -256,6 +262,7 @@ lookup(char *s)
 {
 	/* this has to be sorted always */
 	static const struct keywords keywords[] = {
+		{ "acceptraise",	ACCEPTRAISE},
 		{ "activeborder",	ACTIVEBORDER},
 		{ "autogroup",		AUTOGROUP},
 		{ "bind",		BIND},
diff --git a/xevents.c b/xevents.c
index b1d4c64..0bac911 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 (!(Conf.flags & CONF_ACCEPT_RAISE))
+			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
+	    && Conf.flags & CONF_ACCEPT_RAISE) {
 		if ((old_cc = client_current()))
 			client_ptrsave(old_cc);
 		client_ptrwarp(cc);