From 9612bd6ee2d7033ad66292cd817d1253f5a1567a Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sun, 27 Mar 2022 10:52:10 -0600 Subject: [PATCH] pass mouse clicks through to windows properly --- client.c | 2 +- event.c | 4 +++- manage.c | 4 +++- menu.c | 8 +++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/client.c b/client.c index bed7604..18a0146 100644 --- a/client.c +++ b/client.c @@ -36,7 +36,7 @@ void setactive(Client* c, int on) { c->parent, False, ButtonMask, - GrabModeAsync, + GrabModeSync, GrabModeSync, None, None); diff --git a/event.c b/event.c index 650f01e..f0c5d3e 100644 --- a/event.c +++ b/event.c @@ -62,8 +62,10 @@ void mainloop(int shape_event) { break; case ButtonPress: button(&ev.xbutton); + XAllowEvents(dpy, ReplayPointer, ev.xbutton.time); break; case ButtonRelease: + XAllowEvents(dpy, ReplayPointer, ev.xbutton.time); break; case MapRequest: mapreq(&ev.xmaprequest); @@ -238,7 +240,7 @@ void mapreq(XMapRequestEvent* e) { return; break; } - XReparentWindow(dpy, c->window, c->parent, BORDER - 1, BORDER - 1); + XReparentWindow(dpy, c->window, c->parent, BORDER, BORDER); XAddToSaveSet(dpy, c->window); /* fall through... */ case NormalState: diff --git a/manage.c b/manage.c index 34cf0c9..e73177f 100644 --- a/manage.c +++ b/manage.c @@ -30,6 +30,7 @@ int manage(Client* c, int mapped) { XWMHints* hints; XSetWindowAttributes attrs; XRRMonitorInfo monitor; + ScreenInfo* screen; trace("manage", c, 0); XSelectInput( @@ -141,9 +142,10 @@ int manage(Client* c, int mapped) { } if (c->is9term && !(fixsize ? drag(c, Button3) : sweep(c, Button3))) { + screen = c->screen; XKillClient(dpy, c->window); rmclient(c); - if (current && current->screen == c->screen) + if (current && current->screen == screen) cmapfocus(current); return 0; } diff --git a/menu.c b/menu.c index f1d59f7..5e3df14 100644 --- a/menu.c +++ b/menu.c @@ -146,8 +146,8 @@ void button(XButtonEvent* e) { case Button2: if (c) { XMapRaised(dpy, c->parent); + top(c); active(c); - XAllowEvents(dpy, ReplayPointer, curtime); } else if ( (e->state & (ShiftMask | ControlMask)) == (ShiftMask | ControlMask)) { menuhit(e, &egg); @@ -155,6 +155,12 @@ void button(XButtonEvent* e) { button2(n); return; case Button3: + if (c) { + XMapRaised(dpy, c->parent); + top(c); + active(c); + return; + } break; case Button4: /* scroll up changes to previous virtual screen, wraps around */