aboutsummaryrefslogtreecommitdiffstats
path: root/xevents.c
diff options
context:
space:
mode:
authorokan2019-03-10 20:38:28 +0000
committerokan2019-03-10 20:38:28 +0000
commitb81d279086738e468d862b7f210f6fb0bc73366d (patch)
tree5f0c8e0f39cff437461257fb1d9963992e425dc5 /xevents.c
parent10ee5ec7d4447177b0ab3346ecdf95893997a354 (diff)
downloadcwm-b81d279086738e468d862b7f210f6fb0bc73366d.tar.gz
Find the managed screen from the parent window for client_current().
Diffstat (limited to '')
-rw-r--r--xevents.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/xevents.c b/xevents.c
index 877d0e4..3733419 100644
--- a/xevents.c
+++ b/xevents.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: xevents.c,v 1.143 2019/03/08 17:40:43 okan Exp $
+ * $OpenBSD: xevents.c,v 1.144 2019/03/10 20:38:28 okan Exp $
*/
/*
@@ -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);