summaryrefslogtreecommitdiff
path: root/include/yasl/app.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 15:05:06 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 15:05:06 +0300
commit98f0d51157fa2a2b8ccaae54ed4850a88d223d01 (patch)
tree90b03d0930986620d95eb0f45c07b96e1331783c /include/yasl/app.h
parent339e1ad7adb8340732ee856d0f6f0d2c7f1455d1 (diff)
Simplify surface state, examples, and library installation
Diffstat (limited to 'include/yasl/app.h')
-rw-r--r--include/yasl/app.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/yasl/app.h b/include/yasl/app.h
index 27523d5..112140d 100644
--- a/include/yasl/app.h
+++ b/include/yasl/app.h
@@ -70,6 +70,7 @@ typedef enum yasl_event_type {
YASL_EVENT_PASTE,
YASL_EVENT_DROP_FILES,
YASL_EVENT_USER,
+ YASL_EVENT_INPUT_RESET, /**< Input interrupted; clear held keys/buttons and composition. */
} yasl_event_type;
/** Unified event payload delivered to yasl_app_desc.event(). */
@@ -95,6 +96,7 @@ struct yasl_event {
struct {
struct yasl_vector2i pos; /**< Device-pixel position relative to surface. */
+ enum yasl_pointer_device device; /**< Mouse, touch, pen, or eraser. */
int16_t button; /**< 0 primary, 1 middle, 2 secondary. */
bool pressed; /**< true for press, false for release. */
uint32_t mods;
@@ -104,6 +106,7 @@ struct yasl_event {
struct {
struct yasl_vector2i pos; /**< Device-pixel position relative to surface. */
struct yasl_vector2i delta; /**< Relative motion delta (dx, dy). */
+ enum yasl_pointer_device device; /**< Mouse, touch, pen, or eraser. */
uint32_t mods;
struct yasl_pointer_pen pen;
} mouse_motion;
@@ -271,6 +274,7 @@ struct yasl_app_desc {
/**
* Unified event handler called for input, resize, close, scale, and custom events.
* Event payloads and borrowed strings are valid for the duration of the callback.
+ * INPUT_RESET has no payload and requires clearing held application input.
* Return YASL_APP_CONTINUE or YASL_APP_QUIT.
*/
int (*event)(void *ud, const struct yasl_event *ev);
@@ -293,6 +297,8 @@ struct yasl_app_desc {
* Handles the display event loop, live-resizing, pacing, and cleanup.
* @param desc Application callbacks and options.
* @return 0 on orderly exit, or non-zero on error.
+ * Display quit notifications stop the runner; connection loss and dispatch
+ * failures return an error after application cleanup.
*/
YASL_API int yasl_run(const struct yasl_app_desc *desc);