pass mouse clicks through to windows properly

This commit is contained in:
Iris Lightshard 2022-03-27 10:52:10 -06:00
parent 16ed0f7f24
commit 9612bd6ee2
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
4 changed files with 14 additions and 4 deletions

View file

@ -36,7 +36,7 @@ void setactive(Client* c, int on) {
c->parent, c->parent,
False, False,
ButtonMask, ButtonMask,
GrabModeAsync, GrabModeSync,
GrabModeSync, GrabModeSync,
None, None,
None); None);

View file

@ -62,8 +62,10 @@ void mainloop(int shape_event) {
break; break;
case ButtonPress: case ButtonPress:
button(&ev.xbutton); button(&ev.xbutton);
XAllowEvents(dpy, ReplayPointer, ev.xbutton.time);
break; break;
case ButtonRelease: case ButtonRelease:
XAllowEvents(dpy, ReplayPointer, ev.xbutton.time);
break; break;
case MapRequest: case MapRequest:
mapreq(&ev.xmaprequest); mapreq(&ev.xmaprequest);
@ -238,7 +240,7 @@ void mapreq(XMapRequestEvent* e) {
return; return;
break; break;
} }
XReparentWindow(dpy, c->window, c->parent, BORDER - 1, BORDER - 1); XReparentWindow(dpy, c->window, c->parent, BORDER, BORDER);
XAddToSaveSet(dpy, c->window); XAddToSaveSet(dpy, c->window);
/* fall through... */ /* fall through... */
case NormalState: case NormalState:

View file

@ -30,6 +30,7 @@ int manage(Client* c, int mapped) {
XWMHints* hints; XWMHints* hints;
XSetWindowAttributes attrs; XSetWindowAttributes attrs;
XRRMonitorInfo monitor; XRRMonitorInfo monitor;
ScreenInfo* screen;
trace("manage", c, 0); trace("manage", c, 0);
XSelectInput( XSelectInput(
@ -141,9 +142,10 @@ int manage(Client* c, int mapped) {
} }
if (c->is9term && !(fixsize ? drag(c, Button3) : sweep(c, Button3))) { if (c->is9term && !(fixsize ? drag(c, Button3) : sweep(c, Button3))) {
screen = c->screen;
XKillClient(dpy, c->window); XKillClient(dpy, c->window);
rmclient(c); rmclient(c);
if (current && current->screen == c->screen) if (current && current->screen == screen)
cmapfocus(current); cmapfocus(current);
return 0; return 0;
} }

8
menu.c
View file

@ -146,8 +146,8 @@ void button(XButtonEvent* e) {
case Button2: case Button2:
if (c) { if (c) {
XMapRaised(dpy, c->parent); XMapRaised(dpy, c->parent);
top(c);
active(c); active(c);
XAllowEvents(dpy, ReplayPointer, curtime);
} else if ( } else if (
(e->state & (ShiftMask | ControlMask)) == (ShiftMask | ControlMask)) { (e->state & (ShiftMask | ControlMask)) == (ShiftMask | ControlMask)) {
menuhit(e, &egg); menuhit(e, &egg);
@ -155,6 +155,12 @@ void button(XButtonEvent* e) {
button2(n); button2(n);
return; return;
case Button3: case Button3:
if (c) {
XMapRaised(dpy, c->parent);
top(c);
active(c);
return;
}
break; break;
case Button4: case Button4:
/* scroll up changes to previous virtual screen, wraps around */ /* scroll up changes to previous virtual screen, wraps around */