summaryrefslogtreecommitdiff
path: root/src/platform/wayland/surface.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 16:23:07 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 16:23:07 +0300
commit276a70a84fed5be229c12546df1ac393158a4ec9 (patch)
treef3d0e00d6339efacc466b32048644c388315e90d /src/platform/wayland/surface.c
parent138b9c40aa211edff1d0201083aa25a8b467ee15 (diff)
Implement relative pointer mode on Wayland
yasl_surface_set_pointer_mode(YASL_POINTER_RELATIVE) now takes a persistent zwp_locked_pointer_v1 on the surface and hides its cursor. While the compositor keeps the lock engaged, zwp_relative_pointer_v1 motion is pushed as POINTER_MOTION with pos frozen and delta in device pixels. When the lock disengages, as on focus loss, motion is absolute again with a delta derived by the input queue. The lock follows the pointer's seat: it moves to another seat when its seat loses the pointer, and is released on NORMAL and on surface destruction. Compositors without both protocols return false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/platform/wayland/surface.c')
-rw-r--r--src/platform/wayland/surface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/platform/wayland/surface.c b/src/platform/wayland/surface.c
index ad3a24c..b17d203 100644
--- a/src/platform/wayland/surface.c
+++ b/src/platform/wayland/surface.c
@@ -200,6 +200,8 @@ static void display_free(struct wayland_display *c)
if (c->primary_selection_mgr) zwp_primary_selection_device_manager_v1_destroy(c->primary_selection_mgr);
if (c->data_manager) wl_data_device_manager_destroy(c->data_manager);
if (c->cursor_shape_mgr) wp_cursor_shape_manager_v1_destroy(c->cursor_shape_mgr);
+ if (c->relative_pointer_mgr) zwp_relative_pointer_manager_v1_destroy(c->relative_pointer_mgr);
+ if (c->pointer_constraints) zwp_pointer_constraints_v1_destroy(c->pointer_constraints);
if (c->cursor_theme) wl_cursor_theme_destroy(c->cursor_theme);
if (c->tablet_mgr) zwp_tablet_manager_v2_destroy(c->tablet_mgr);
if (c->text_input_mgr) zwp_text_input_manager_v3_destroy(c->text_input_mgr);
@@ -399,6 +401,7 @@ void wayland_surface_destroy(struct wayland_surface *w)
if (!w || w->destroyed) return;
for (struct wayland_surface *o = w->conn ? w->conn->surfaces : NULL; o; o = o->conn_next)
assert(o->parent != w && "destroy a popup before its parent");
+ surface_unlock_pointer(w);
input_queue_clear(&w->input);
free(w->ime_preedit);
free(w->ime_commit);