From 5553ea232b276ac454c048f3f9d9548536a69f05 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Mon, 30 Dec 2013 02:20:53 +0100 Subject: don't raise windows with the CWM_NORAISE property set --- calmwm.h | 2 ++ conf.c | 1 + xevents.c | 6 +++++- xutil.c | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) 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) { -- cgit 1.4.1