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,
False,
ButtonMask,
GrabModeAsync,
GrabModeSync,
GrabModeSync,
None,
None);

View file

@ -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:

View file

@ -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;
}

8
menu.c
View file

@ -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 */