2019-09-14 22:43:35 +00:00
|
|
|
void
|
|
|
|
warp(const Client *c)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
if (!c) {
|
2020-08-27 04:26:48 +00:00
|
|
|
XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh / 2);
|
2019-09-14 22:43:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getrootptr(&x, &y) ||
|
2020-08-27 04:26:48 +00:00
|
|
|
(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
|
2020-08-23 12:32:59 +00:00
|
|
|
)
|
2019-09-14 22:43:35 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
|
2020-08-27 04:26:48 +00:00
|
|
|
}
|