Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
670 B

  1. void
  2. warp(const Client *c)
  3. {
  4. Monitor *m;
  5. Bar *bar;
  6. int x, y;
  7. if (ignore_warp)
  8. return;
  9. if (!c) {
  10. XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh / 2);
  11. return;
  12. }
  13. if (!getrootptr(&x, &y))
  14. return;
  15. if (!force_warp &&
  16. (x > c->x - c->bw &&
  17. y > c->y - c->bw &&
  18. x < c->x + c->w + c->bw*2 &&
  19. y < c->y + c->h + c->bw*2))
  20. return;
  21. force_warp = 0;
  22. for (m = mons; m; m = m->next)
  23. for (bar = m->bar; bar; bar = bar->next)
  24. if (x > bar->bx &&
  25. x < bar->bx + bar->bw &&
  26. y > bar->by &&
  27. y < bar->by + bar->bh)
  28. return;
  29. XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
  30. }