aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2015-08-24 15:42:57 +0000
committerokan2015-08-24 15:42:57 +0000
commitf507af43cc37948b1f83ba74c8200059d4bba742 (patch)
tree6629cf1dd78ec54bda03a6198f59318e4378efed
parente76666595f56078b393ce83cc4f32f2cfd5f24b9 (diff)
downloadcwm-f507af43cc37948b1f83ba74c8200059d4bba742.tar.gz
Implement _NET_CLIENT_LIST_STACKING (from Thomas Admin), but
bottom-to-top order, as per spec (notified Thomas as well).
-rw-r--r--calmwm.h4
-rw-r--r--client.c4
-rw-r--r--conf.c3
-rw-r--r--xutil.c23
4 files changed, 30 insertions, 4 deletions
diff --git a/calmwm.h b/calmwm.h
index ba311f1..35bf72d 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.301 2015/08/24 14:56:10 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.302 2015/08/24 15:42:57 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -352,6 +352,7 @@ enum {
_NET_SUPPORTING_WM_CHECK,
_NET_ACTIVE_WINDOW,
_NET_CLIENT_LIST,
+ _NET_CLIENT_LIST_STACKING,
_NET_NUMBER_OF_DESKTOPS,
_NET_CURRENT_DESKTOP,
_NET_DESKTOP_VIEWPORT,
@@ -562,6 +563,7 @@ void xu_ewmh_net_supported_wm_check(struct screen_ctx *);
void xu_ewmh_net_desktop_geometry(struct screen_ctx *);
void xu_ewmh_net_workarea(struct screen_ctx *);
void xu_ewmh_net_client_list(struct screen_ctx *);
+void xu_ewmh_net_client_list_stacking(struct screen_ctx *);
void xu_ewmh_net_active_window(struct screen_ctx *, Window);
void xu_ewmh_net_wm_desktop_viewport(struct screen_ctx *);
void xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *);
diff --git a/client.c b/client.c
index 6e8d5e0..cf23cda 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.204 2015/08/24 14:57:19 okan Exp $
+ * $OpenBSD: client.c,v 1.205 2015/08/24 15:42:57 okan Exp $
*/
#include <sys/types.h>
@@ -112,6 +112,7 @@ client_init(Window win, struct screen_ctx *sc)
TAILQ_INSERT_TAIL(&sc->clientq, cc, entry);
xu_ewmh_net_client_list(sc);
+ xu_ewmh_net_client_list_stacking(sc);
xu_ewmh_restore_net_wm_state(cc);
if (client_get_wm_state(cc) == IconicState)
@@ -152,6 +153,7 @@ client_delete(struct client_ctx *cc)
TAILQ_REMOVE(&sc->clientq, cc, entry);
xu_ewmh_net_client_list(sc);
+ xu_ewmh_net_client_list_stacking(sc);
if (cc->group != NULL)
TAILQ_REMOVE(&cc->group->clientq, cc, group_entry);
diff --git a/conf.c b/conf.c
index 4a2b4e3..92594c4 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: conf.c,v 1.196 2015/08/24 14:56:10 okan Exp $
+ * $OpenBSD: conf.c,v 1.197 2015/08/24 15:42:57 okan Exp $
*/
#include <sys/types.h>
@@ -668,6 +668,7 @@ static char *ewmhints[] = {
"_NET_SUPPORTING_WM_CHECK",
"_NET_ACTIVE_WINDOW",
"_NET_CLIENT_LIST",
+ "_NET_CLIENT_LIST_STACKING",
"_NET_NUMBER_OF_DESKTOPS",
"_NET_CURRENT_DESKTOP",
"_NET_DESKTOP_VIEWPORT",
diff --git a/xutil.c b/xutil.c
index 9ab6d39..c833619 100644
--- a/xutil.c
+++ b/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xutil.c,v 1.101 2015/08/24 14:56:10 okan Exp $
+ * $OpenBSD: xutil.c,v 1.102 2015/08/24 15:42:57 okan Exp $
*/
#include <sys/types.h>
@@ -229,6 +229,27 @@ xu_ewmh_net_client_list(struct screen_ctx *sc)
}
void
+xu_ewmh_net_client_list_stacking(struct screen_ctx *sc)
+{
+ struct client_ctx *cc;
+ Window *winlist;
+ int i = 0, j;
+
+ TAILQ_FOREACH(cc, &sc->clientq, entry)
+ i++;
+ if (i == 0)
+ return;
+
+ j = i;
+ winlist = xreallocarray(NULL, i, sizeof(*winlist));
+ TAILQ_FOREACH(cc, &sc->clientq, entry)
+ winlist[--j] = cc->win;
+ XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST_STACKING],
+ XA_WINDOW, 32, PropModeReplace, (unsigned char *)winlist, i);
+ free(winlist);
+}
+
+void
xu_ewmh_net_active_window(struct screen_ctx *sc, Window w)
{
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_ACTIVE_WINDOW],