summaryrefslogtreecommitdiff
path: root/src/common/input.h
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 /src/common/input.h
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 'src/common/input.h')
-rw-r--r--src/common/input.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/input.h b/src/common/input.h
index ffd1663..aad5c9a 100644
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -15,11 +15,16 @@ struct input_queue {
bool relative;
struct yasl_surface *reset_surface;
bool reset_pending;
+ /* YASL_BUTTON_BIT() mask from pushed DOWN/UP events. */
+ uint32_t buttons;
+ /* Set by backends whose pointer leave ends any press: no release follows. */
+ bool leave_ends_press;
};
/* Copies text payloads and stamps time_ns when zero. Unless q->relative is set,
* POINTER_MOTION delta is computed from the previous position; otherwise the
- * backend-supplied delta is kept. Leave and reset clear the position history. */
+ * backend-supplied delta is kept. Leave and reset clear the position history.
+ * Pointer events get the held-button mask; reset clears it. */
bool input_queue_push(struct input_queue *q, const struct yasl_event *ev);
bool input_queue_pop(struct input_queue *q, struct yasl_event *ev);
void input_queue_clear(struct input_queue *q);