diff options
-rw-r--r-- | calmwm.h | 1 | ||||
-rw-r--r-- | conf.c | 1 | ||||
-rw-r--r-- | cwmrc.5 | 8 | ||||
-rw-r--r-- | parse.y | 9 | ||||
-rw-r--r-- | xevents.c | 6 |
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); |