From 98f0d51157fa2a2b8ccaae54ed4850a88d223d01 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 15:05:06 +0300 Subject: Simplify surface state, examples, and library installation --- include/yasl/app.h | 6 ++++++ include/yasl/yasl.h | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'include/yasl') 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); diff --git a/include/yasl/yasl.h b/include/yasl/yasl.h index e2c1d77..3b3b712 100644 --- a/include/yasl/yasl.h +++ b/include/yasl/yasl.h @@ -153,6 +153,7 @@ enum yasl_surface_state : uint32_t { YASL_STATE_ACTIVATED = 1 << 2, /**< Active window. */ YASL_STATE_SUSPENDED = 1 << 3, /**< Compositor reports suspension. */ YASL_STATE_CSD = 1 << 4, /**< Backend reports client-side decorations. */ + YASL_STATE_TILED = 1 << 5, /**< At least one edge is tiled; currently reported by Wayland. */ }; /** System cursor shapes. HIDDEN preserves pointer input; NONE is its compatibility alias. */ @@ -448,7 +449,7 @@ struct yasl_window_cbs { void (*configure)(struct yasl_surface *s, struct yasl_geometry geometry, void *ud); /** Window/popup close request; application is responsible for destruction. */ void (*close)(struct yasl_surface *s, void *ud); - /** Reported yasl_surface_state bitmask changed. */ + /** Reported yasl_surface_state bitmask changed; matches yasl_surface_state(s). */ void (*state)(struct yasl_surface *s, uint32_t state, void *ud); /** YASL surface-drag target hover, leave, or drop; pos is in device pixels. */ void (*drag)(struct yasl_surface *s, enum yasl_drag_event ev, @@ -746,6 +747,8 @@ YASL_API struct yasl_geometry yasl_surface_geometry(const struct yasl_surface *s * @param s Surface, or NULL. * @return A bitmask of yasl_surface_state values, or zero for NULL. * Flags are reported state, not requests; unsupported states are absent. + * Flags may coexist. Windowed and floating have no separate flags. Suspension + * does not imply minimization, and no minimized flag is reported. */ YASL_API uint32_t yasl_surface_state(const struct yasl_surface *s); /* Timing uses monotonic nanoseconds. Check source before treating timestamps -- cgit v1.2.3