From 276a70a84fed5be229c12546df1ac393158a4ec9 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 16:23:07 +0300 Subject: 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 --- docs/guide.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/guide.md b/docs/guide.md index a65972f..62c2e1a 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -224,8 +224,12 @@ meaningless. `POINTER_MOTION` reports `delta`, the device-pixel movement since the previous sample, which restarts from zero after enter, leave, or reset. `yasl_surface_set_pointer_mode()` with `YASL_POINTER_RELATIVE` hides and locks the cursor while the surface is focused; motion then carries unbounded `delta` and -`pos` stays at the lock position. No backend implements it yet, so it -currently returns false and leaves the surface in `YASL_POINTER_NORMAL`. Pen +`pos` stays at the lock position. Wayland implements it with the +relative-pointer and pointer-constraints protocols, reporting the compositor's +accelerated motion in device pixels. The compositor decides when the lock +engages; until then, and while it is released on focus loss, motion stays +absolute with a computed `delta`. X11, Cocoa, and compositors without those +protocols return false and keep the current mode. Pen pressure is normalized to 0..65535, signed tilt is in degrees, and missing axes are zero. Pressure-only changes can produce motion. Zero pressure alone does not mean release. This interface does not expose simultaneous touch contacts. -- cgit v1.2.3