summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2019-03-10 20:38:28 +0000
committerokan <okan>2019-03-10 20:38:28 +0000
commit5bc2098c6f9f1e95462e43adcd2922d7730c0b60 (patch)
tree8d5563288eab7877d5d992da5b1b6c474e490663
parent5071baa2aad12f8de2c9591fdf753ff4edec5df7 (diff)
downloadcwm-5bc2098c6f9f1e95462e43adcd2922d7730c0b60.tar.gz
cwm-5bc2098c6f9f1e95462e43adcd2922d7730c0b60.tar.xz
cwm-5bc2098c6f9f1e95462e43adcd2922d7730c0b60.zip
Find the managed screen from the parent window for client_current().
-rw-r--r--xevents.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/xevents.c b/xevents.c
index c35e87a..15f7e10 100644
--- a/xevents.c
+++ b/xevents.c
@@ -75,11 +75,15 @@ static void
 xev_handle_maprequest(XEvent *ee)
 {
 	XMapRequestEvent	*e = &ee->xmaprequest;
-	struct client_ctx	*cc = NULL, *old_cc;
+	struct screen_ctx	*sc;
+	struct client_ctx	*cc, *old_cc;
 
-	LOG_DEBUG3("window: 0x%lx", e->window);
+	LOG_DEBUG3("parent: 0x%lx window: 0x%lx", e->parent, e->window);
+
+	if ((sc = screen_find(e->parent)) == NULL)
+		return;
 
-	if ((old_cc = client_current(NULL)) != NULL)
+	if ((old_cc = client_current(sc)) != NULL)
 		client_ptrsave(old_cc);
 
 	if ((cc = client_find(e->window)) == NULL)
@@ -355,7 +359,7 @@ xev_handle_keyrelease(XEvent *ee)
 	keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0);
 	for (i = 0; i < nitems(modkeys); i++) {
 		if (keysym == modkeys[i]) {
-			if ((cc = client_current(NULL)) != NULL) {
+			if ((cc = client_current(sc)) != NULL) {
 				if (sc->cycling) {
 					sc->cycling = 0;
 					client_mtf(cc);