commit ab22399f41af4f9ff7b7abd8fc0edf925a4cda94
parent 40de90adef2ed217d139f1c576c2f2f6137759b0
Author: Jake Koroman <jakekoroman@gmail.com>
Date: Mon, 15 Jul 2024 21:02:34 -0400
added cursorwarptocenter()
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/dwl/dwl.c b/dwl/dwl.c
@@ -287,6 +287,7 @@ static void createpointer(struct wlr_pointer *pointer);
static void createpointerconstraint(struct wl_listener *listener, void *data);
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
static void cursorframe(struct wl_listener *listener, void *data);
+static void cursorwarptocenter(void);
static void cursorwarptohint(void);
static void destroydecoration(struct wl_listener *listener, void *data);
static void destroydragicon(struct wl_listener *listener, void *data);
@@ -1241,6 +1242,13 @@ cursorframe(struct wl_listener *listener, void *data)
wlr_seat_pointer_notify_frame(seat);
}
+void cursorwarptocenter(void)
+{
+ wlr_cursor_warp_closest(cursor, NULL,
+ selmon->w.x + selmon->w.width / 2,
+ selmon->w.y + selmon->w.height / 2);
+}
+
void
cursorwarptohint(void)
{
@@ -1677,6 +1685,7 @@ focusmon(const Arg *arg)
selmon = dirtomon(arg->i);
while (!selmon->wlr_output->enabled && i++ < nmons);
}
+ cursorwarptocenter();
focusclient(focustop(selmon), 1);
}
@@ -3003,6 +3012,7 @@ tagmon(const Arg *arg)
if (sel) {
setmon(sel, dirtomon(arg->i), 0);
focusmon(arg);
+ cursorwarptocenter();
}
}