diff options
| author | bakkeby <[email protected]> | 2019-09-15 00:43:35 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2019-09-15 00:46:00 +0200 |
| commit | 30e0a3b5e42185836bd4cf4d591351dacc6b723c (patch) | |
| tree | aa9af6357adf7e98c7dff03d88620f9b36b5484c /patch/warp.c | |
| parent | 713c4e619749e437970dee379d65417f9a1849b3 (diff) | |
| download | dwm-flexipatch-30e0a3b5e42185836bd4cf4d591351dacc6b723c.tar.gz dwm-flexipatch-30e0a3b5e42185836bd4cf4d591351dacc6b723c.zip | |
Adding sticky and warp patches
Diffstat (limited to 'patch/warp.c')
| -rw-r--r-- | patch/warp.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/patch/warp.c b/patch/warp.c new file mode 100644 index 0000000..0989de7 --- /dev/null +++ b/patch/warp.c @@ -0,0 +1,21 @@ +void +warp(const Client *c) +{ + int x, y; + + if (!c) { + XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2); + return; + } + + if (!getrootptr(&x, &y) || + (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) || + (y > c->mon->by && y < c->mon->by + bh) || + (c->mon->topbar && !y)) + return; + + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2); +}
\ No newline at end of file |
