commit d1ec3e24c7e0b7400dc5c0e4dfb7194e805a489d
parent 1fdeebd9f7c75e650c344922eb6e764707af3a20
Author: shrub <maybeshrub@gmail.com>
Date: Fri, 2 Oct 2026 21:44:18 +0000
Merge branch 'main' of git.sr.ht:~shrub900/neuswc
Diffstat:
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/libswc/swc.c b/libswc/swc.c
@@ -153,6 +153,20 @@ swc_cursor_position(int32_t *x, int32_t *y)
}
EXPORT bool
+swc_cursor_set_position(int32_t x, int32_t y)
+{
+ if (!swc.seat || !swc.seat->pointer) {
+ return false;
+ }
+
+ pointer_handle_absolute_motion(swc.seat->pointer, get_time(),
+ wl_fixed_from_int(x), wl_fixed_from_int(y));
+ pointer_handle_frame(swc.seat->pointer);
+
+ return true;
+}
+
+EXPORT bool
swc_initialize(struct wl_display *display, struct wl_event_loop *event_loop,
const struct swc_manager *manager)
{
diff --git a/libswc/swc.h b/libswc/swc.h
@@ -49,6 +49,16 @@ bool
swc_cursor_position(int32_t *x, int32_t *y);
/**
+ * Set the cursor position.
+ *
+ * The coordinates are in compositor-global space, exposed as raw int32_t
+ * to avoid needing wayland headers. This has the same effect as the
+ * cursor being moved there by an input device.
+ */
+bool
+swc_cursor_set_position(int32_t x, int32_t y);
+
+/**
* Send a pointer button event to the currently focused client.
*
* This is intended for window managers which intercept button events (for