summaryrefslogtreecommitdiff
path: root/src/platform/wayland/backend.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/backend.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/backend.c')
-rw-r--r--src/platform/wayland/backend.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/platform/wayland/backend.c b/src/platform/wayland/backend.c
index 1d83ec6..c3c7bed 100644
--- a/src/platform/wayland/backend.c
+++ b/src/platform/wayland/backend.c
@@ -126,6 +126,11 @@ static void impl_surface_set_cursor(struct yasl_surface *s, enum yasl_cursor cur
wayland_surface_set_cursor((struct wayland_surface *)s, cursor);
}
+static bool impl_surface_set_pointer_mode(struct yasl_surface *s, enum yasl_pointer_mode mode)
+{
+ return wayland_surface_set_pointer_mode((struct wayland_surface *)s, mode);
+}
+
static void impl_surface_set_background_color(struct yasl_surface *s, uint32_t bg)
{
wayland_surface_set_background_color((struct wayland_surface *)s, bg);
@@ -206,6 +211,7 @@ const struct yasl_backend_ops yasl_wayland_backend = {
.surface_schedule_redraw = impl_surface_schedule_redraw,
.surface_present = impl_surface_present,
.surface_poll_event = impl_surface_poll_event,
+ .surface_set_pointer_mode = impl_surface_set_pointer_mode,
.surface_geometry = impl_surface_geometry,
.surface_timing = impl_surface_timing,
.surface_frame_time_ns = impl_surface_frame_time_ns,