aboutsummaryrefslogtreecommitdiffstats
path: root/modules/warptoclient
diff options
context:
space:
mode:
Diffstat (limited to 'modules/warptoclient')
-rw-r--r--modules/warptoclient/warptoclient.c15
-rw-r--r--modules/warptoclient/warptoclient.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/modules/warptoclient/warptoclient.c b/modules/warptoclient/warptoclient.c
new file mode 100644
index 0000000..fbedeaa
--- /dev/null
+++ b/modules/warptoclient/warptoclient.c
@@ -0,0 +1,15 @@
+void
+warptoclient(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;
+ }
+
+ x = c->x + WIDTH(c) / 2;
+ y = c->y + HEIGHT(c) / 2;
+
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, x, y);
+}
diff --git a/modules/warptoclient/warptoclient.h b/modules/warptoclient/warptoclient.h
new file mode 100644
index 0000000..0017968
--- /dev/null
+++ b/modules/warptoclient/warptoclient.h
@@ -0,0 +1 @@
+static void warptoclient(Client *c);