summaryrefslogtreecommitdiff
path: root/app/cwm/screen.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2016-09-16 14:32:03 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2016-09-16 14:32:03 +0000
commitab9a91599ced007e4aebd94a8eeb120a641453c2 (patch)
treeafff2902f770104a1195b8375fb7c51268566862 /app/cwm/screen.c
parent030169216e9b075261283ee3ba07182f30dbe8ca (diff)
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 'app/cwm/screen.c')
-rw-r--r--app/cwm/screen.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/cwm/screen.c b/app/cwm/screen.c
index e1f5fe8c9..9f3eb47cb 100644
--- a/app/cwm/screen.c
+++ b/app/cwm/screen.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: screen.c,v 1.79 2015/11/11 14:22:01 okan Exp $
+ * $OpenBSD: screen.c,v 1.80 2016/09/16 14:32:02 okan Exp $
*/
#include <sys/types.h>
@@ -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);
}