summaryrefslogtreecommitdiffhomepage
path: root/patch/warp.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-09-27 11:15:45 +0200
committerbakkeby <[email protected]>2020-09-27 11:15:45 +0200
commitfcf96c0920fa81541d4b003c5828113338d3d896 (patch)
treee07b5715c86e5466d54c1c7366539e4ffde09deb /patch/warp.c
parent74c9528c385310a57e9da1ad365d1c1429a7c89f (diff)
downloaddwm-flexipatch-fcf96c0920fa81541d4b003c5828113338d3d896.tar.gz
dwm-flexipatch-fcf96c0920fa81541d4b003c5828113338d3d896.zip
warp: do not warp if mouse cursor is on top of any of the bars
Diffstat (limited to 'patch/warp.c')
-rw-r--r--patch/warp.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/patch/warp.c b/patch/warp.c
index 58e2c99..45048e2 100644
--- a/patch/warp.c
+++ b/patch/warp.c
@@ -1,6 +1,8 @@
void
warp(const Client *c)
{
+ Monitor *m;
+ Bar *bar;
int x, y;
if (!c) {
@@ -12,13 +14,17 @@ warp(const Client *c)
(x > c->x - c->bw &&
y > c->y - c->bw &&
x < c->x + c->w + c->bw*2 &&
- y < c->y + c->h + c->bw*2) ||
- (x < c->mon->wx &&
- x > c->mon->wx + c->mon->ww) ||
- (y < c->mon->wy ||
- y > c->mon->wy + c->mon->wh)
+ y < c->y + c->h + c->bw*2)
)
return;
+ for (m = mons; m; m = m->next)
+ for (bar = m->bar; bar; bar = bar->next)
+ if (x > bar->bx &&
+ x < bar->bx + bar->bw &&
+ y > bar->by &&
+ y < bar->by + bar->bh)
+ return;
+
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
}