From cbd1fc7ee6dced7ad6beecd5b9ad56a7f977f0c4 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 16:57:59 +0300 Subject: Report held pointer buttons on every pointer event Pointer events set button only on press and release, so wsap_term tracked held buttons itself to tell a drag from a hover. yasl_pointer_event.buttons now holds a YASL_BUTTON_BIT() mask of the buttons held after each event. The common input queue tracks it from the DOWN and UP events it queues, and clears it on INPUT_RESET and on allocation failure. Wayland also clears it on leave, since the compositor sends leave during a press only when it takes the pointer and no release follows. X11 and Cocoa keep it, because they deliver motion and the release to the pressed window after leave. Co-Authored-By: Claude Opus 5.5 --- docs/guide.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'docs/guide.md') diff --git a/docs/guide.md b/docs/guide.md index 888e4ab..61583b1 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -219,8 +219,13 @@ remain available for commands; input methods may consume keys while composing. Pointer events use the `YASL_EVENT_POINTER_*` types and share `event.pointer`, with `device` distinguishing mouse, touch, pen, and eraser. `POINTER_DOWN` and `POINTER_UP` carry a `YASL_BUTTON_*` value: `PRIMARY` is the left button, pen tip, -or touch contact. Track those transitions; other types leave `button` -meaningless. `POINTER_MOTION` reports `delta`, the device-pixel movement since +or touch contact. Other types leave `button` meaningless. Every pointer event +also carries `buttons`, a `YASL_BUTTON_BIT()` mask of the buttons held after +that event, tracked from the queue's down and up events. Use it to tell a drag +from a hover. `YASL_EVENT_INPUT_RESET` clears the mask. On Wayland, +`POINTER_LEAVE` also clears it, because the compositor sends leave during a +press only when it takes the pointer away. X11 and Cocoa keep the press across +leave and still deliver the release. `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 -- cgit v1.2.3