From f507af43cc37948b1f83ba74c8200059d4bba742 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 24 Aug 2015 15:42:57 +0000 Subject: Implement _NET_CLIENT_LIST_STACKING (from Thomas Admin), but bottom-to-top order, as per spec (notified Thomas as well). --- xutil.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'xutil.c') 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 @@ -228,6 +228,27 @@ xu_ewmh_net_client_list(struct screen_ctx *sc) free(winlist); } +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) { -- cgit v1.2.3-2-gb3c3