summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 16:57:59 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 16:57:59 +0300
commitcbd1fc7ee6dced7ad6beecd5b9ad56a7f977f0c4 (patch)
treec139512cba169031becf6cc2bc2b0429a2e1546a /docs
parentefca84e8b5204c4d5ce28113474df0bf0b67dbf3 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/guide.md9
1 files changed, 7 insertions, 2 deletions
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