summaryrefslogtreecommitdiff
path: root/togglemouse.c
diff options
context:
space:
mode:
authorProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-08-18 20:03:05 +0100
committerProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-08-18 20:03:05 +0100
commitce9e4453d2ed41c27c72c0a51948995f3f122fcd (patch)
tree19bc4a616cf4f143260bf8d31fbe6574024b8373 /togglemouse.c
parent2faa0fa7bfd3379dc7fe6e337688adf08c32c7b7 (diff)
move functions from search.c and togglemouse.c into dwm.c
Diffstat (limited to 'togglemouse.c')
-rw-r--r--togglemouse.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/togglemouse.c b/togglemouse.c
deleted file mode 100644
index 9c46189..0000000
--- a/togglemouse.c
+++ /dev/null
@@ -1,48 +0,0 @@
-static Window fw = 0;
-static int locked = 0;
-
-void
-togglemouse(const Arg *arg) {
- if (locked) {
- XUngrabPointer(dpy, CurrentTime);
- XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
- if (fw) {
- XDestroyWindow(dpy, fw);
- fw = 0;
- }
- locked = 0;
- return;
- }
-
- Window root = RootWindow(dpy, screen);
-
- XSetWindowAttributes attrs;
- attrs.override_redirect = True;
- attrs.event_mask = 0;
-
- fw = XCreateWindow(
- dpy, root, 0, sh - 1, 1, 1, 0,
- DefaultDepth(dpy, screen),
- InputOutput, DefaultVisual(dpy, screen),
- CWOverrideRedirect | CWEventMask, &attrs
- );
-
- XMapRaised(dpy, fw);
- XSync(dpy, False);
-
- XWarpPointer(dpy, None, root, 0, 0, 0, 0, 0, sh - 1);
-
- if (XGrabPointer(dpy, fw, True,
- 0,
- GrabModeAsync,
- GrabModeAsync,
- fw,
- None,
- CurrentTime) != GrabSuccess) {
- XDestroyWindow(dpy, fw);
- fw = 0;
- return;
- }
-
- locked = 1;
-}