commit 35d8564

wh1tepearl  ·  2026-09-04 19:45:45 +0000 UTC
parent 5d32737
pointer: add swc_cursor_set_position function

Add swc_cursor_set_position function so a compositor will be able to set pointer position.
2 files changed,  +24, -0
+14, -0
 1@@ -152,6 +152,20 @@ swc_cursor_position(int32_t *x, int32_t *y)
 2 	return true;
 3 }
 4 
 5+EXPORT bool
 6+swc_cursor_set_position(int32_t x, int32_t y)
 7+{
 8+	if (!swc.seat || !swc.seat->pointer) {
 9+		return false;
10+	}
11+
12+	pointer_handle_absolute_motion(swc.seat->pointer, get_time(),
13+	                               wl_fixed_from_int(x), wl_fixed_from_int(y));
14+	pointer_handle_frame(swc.seat->pointer);
15+
16+	return true;
17+}
18+
19 EXPORT bool
20 swc_initialize(struct wl_display *display, struct wl_event_loop *event_loop,
21                const struct swc_manager *manager)
+10, -0
 1@@ -48,6 +48,16 @@ struct wld_buffer;
 2 bool
 3 swc_cursor_position(int32_t *x, int32_t *y);
 4 
 5+/**
 6+ * Set the cursor position.
 7+ *
 8+ * The coordinates are in compositor-global space, exposed as raw int32_t
 9+ * to avoid needing wayland headers. This has the same effect as the
10+ * cursor being moved there by an input device.
11+ */
12+bool
13+swc_cursor_set_position(int32_t x, int32_t y);
14+
15 /**
16  * Send a pointer button event to the currently focused client.
17  *