about summary refs log tree commit diff
path: root/xutil.c
diff options
context:
space:
mode:
authorokan <okan>2016-09-16 14:32:02 +0000
committerokan <okan>2016-09-16 14:32:02 +0000
commitfa06851b0ee5b49138f782e500e12646455dd171 (patch)
treed79d5fa97a78d6df308cb536d6bd15e9a30a0737 /xutil.c
parent8d44e4b3e834663253dee110e98f8284b3092afc (diff)
parent6a53e3a859cd55b6f01ecb2a8a8a30af5d940345 (diff)
downloadcwm-fa06851b0ee5b49138f782e500e12646455dd171.tar.gz
cwm-fa06851b0ee5b49138f782e500e12646455dd171.tar.xz
cwm-fa06851b0ee5b49138f782e500e12646455dd171.zip
cvsimport
* refs/heads/master:
  During init, query screen for _NET_ACTIVE_WINDOW and set that client as active; while we already look at what's under the pointer, use this information first, then look under the pointer (saving that round-trip). This restores the active state to a client after restart even if the pointer is not above it (and of course the pointer is not above another client).
Diffstat (limited to 'xutil.c')
-rw-r--r--xutil.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xutil.c b/xutil.c
index c4db9f6..3393179 100644
--- a/xutil.c
+++ b/xutil.c
@@ -256,6 +256,22 @@ xu_ewmh_net_active_window(struct screen_ctx *sc, Window w)
 	    XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
 }
 
+Window
+xu_ewmh_get_net_active_window(struct screen_ctx *sc)
+{
+	long		*p;
+	Window		 win;
+
+	if ((xu_getprop(sc->rootwin, ewmh[_NET_ACTIVE_WINDOW],
+	    XA_WINDOW, 32, (unsigned char **)&p)) <= 0)
+		return(None);
+
+	win = (Window)*p;
+	XFree(p);
+
+	return(win);
+}
+
 void
 xu_ewmh_net_wm_desktop_viewport(struct screen_ctx *sc)
 {