2019-09-14 22:43:35 +00:00
|
|
|
void
|
|
|
|
warp(const Client *c)
|
|
|
|
{
|
2020-09-27 09:15:45 +00:00
|
|
|
Monitor *m;
|
|
|
|
Bar *bar;
|
2019-09-14 22:43:35 +00:00
|
|
|
int x, y;
|
|
|
|
|
2020-10-06 06:45:17 +00:00
|
|
|
if (ignore_warp)
|
|
|
|
return;
|
|
|
|
|
2019-09-14 22:43:35 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-10-06 10:45:09 +00:00
|
|
|
if (!getrootptr(&x, &y))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!force_warp &&
|
|
|
|
(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))
|
|
|
|
return;
|
|
|
|
|
|
|
|
force_warp = 0;
|
2019-09-14 22:43:35 +00:00
|
|
|
|
2020-10-06 10:45:09 +00:00
|
|
|
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;
|
2020-09-27 09:15:45 +00:00
|
|
|
|
2019-09-14 22:43:35 +00:00
|
|
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
|
2020-08-27 04:26:48 +00:00
|
|
|
}
|