]> git.sur5r.net Git - i3/i3/blobdiff - src/xcb.c
Merge branch 'master' into next
[i3/i3] / src / xcb.c
index 2c194013b09172d2fc784c11dfc3362569e053fe..b11b0ca62b54c8ed7cfa882fea426d3d96ae46d1 100644 (file)
--- a/src/xcb.c
+++ b/src/xcb.c
@@ -361,3 +361,15 @@ bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom) {
     return false;
 
 }
+
+/**
+ * Moves the mouse pointer into the middle of rect.
+ *
+ */
+void xcb_warp_pointer_rect(xcb_connection_t *conn, Rect *rect) {
+    int mid_x = rect->x + (rect->width / 2);
+    int mid_y = rect->y + (rect->height / 2);
+
+    LOG("warp pointer to: %d %d\n", mid_x, mid_y);
+    xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, mid_x, mid_y);
+}