summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authorokan <okan>2016-09-16 14:32:02 +0000
committerokan <okan>2016-09-16 14:32:02 +0000
commit6a53e3a859cd55b6f01ecb2a8a8a30af5d940345 (patch)
treea12b6268f4446ce69a18a218e8996ebfe18e4786 /screen.c
parent2bbe111cc0e2ddd8b684e22dab337086c39ac46a (diff)
downloadcwm-6a53e3a859cd55b6f01ecb2a8a8a30af5d940345.tar.gz
cwm-6a53e3a859cd55b6f01ecb2a8a8a30af5d940345.tar.xz
cwm-6a53e3a859cd55b6f01ecb2a8a8a30af5d940345.zip
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 'screen.c')
-rw-r--r--screen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/screen.c b/screen.c
index a1b8b30..7f2132f 100644
--- a/screen.c
+++ b/screen.c
@@ -35,7 +35,7 @@ void
 screen_init(int which)
 {
 	struct screen_ctx	*sc;
-	Window			*wins, w0, w1;
+	Window			*wins, w0, w1, active = None;
 	XSetWindowAttributes	 rootattr;
 	unsigned int		 nwins, i;
 
@@ -65,6 +65,7 @@ screen_init(int which)
 	xu_ewmh_net_wm_number_of_desktops(sc);
 	xu_ewmh_net_showing_desktop(sc);
 	xu_ewmh_net_virtual_roots(sc);
+	active = xu_ewmh_get_net_active_window(sc);
 
 	rootattr.cursor = Conf.cursor[CF_NORMAL];
 	rootattr.event_mask = SubstructureRedirectMask |
@@ -77,7 +78,7 @@ screen_init(int which)
 	/* Deal with existing clients. */
 	if (XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins)) {
 		for (i = 0; i < nwins; i++)
-			(void)client_init(wins[i], sc);
+			(void)client_init(wins[i], sc, (active == wins[i]));
 
 		XFree(wins);
 	}