From 5ef6ca21ab9e1cf4f69254234d190a634b777d52 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Wed, 14 Oct 2026 09:38:31 +0300 Subject: Remove deprecated Cocoa OpenGL and private compatibility APIs --- src/common/types.h | 106 +++++++++-------------------------------------------- 1 file changed, 17 insertions(+), 89 deletions(-) (limited to 'src/common/types.h') diff --git a/src/common/types.h b/src/common/types.h index 40c502f..8b9bbba 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -22,7 +22,7 @@ * Coordinates have their origin at the upper left; x grows right and y grows down. * Scale is an integer ratio with YASL_PRIVATE_SCALE_UNIT (120) representing 1x. * See the application guide for the display-wide dispatch/poll/flush cycle - * and backend limits. Legacy surface polling is an input-only filtered adapter. + * and backend limits. */ #ifndef YASL_PRIVATE_H #define YASL_PRIVATE_H @@ -145,7 +145,7 @@ enum yasl_private_surface_state : uint32_t { YASL_PRIVATE_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. */ +/** System cursor shapes. HIDDEN preserves pointer input. */ enum yasl_private_cursor { YASL_PRIVATE_CURSOR_ARROW, /**< Default arrow. */ YASL_PRIVATE_CURSOR_TEXT, /**< Text insertion. */ @@ -157,7 +157,6 @@ enum yasl_private_cursor { YASL_PRIVATE_CURSOR_RESIZE_EW, /**< Horizontal resize. */ YASL_PRIVATE_CURSOR_RESIZE_NS, /**< Vertical resize. */ YASL_PRIVATE_CURSOR_HIDDEN, /**< Hidden system cursor; pointer input continues. */ - YASL_PRIVATE_CURSOR_NONE = YASL_PRIVATE_CURSOR_HIDDEN, /**< Compatibility alias for HIDDEN. */ }; /** Valid interactive resize edges; combinations are restricted to the named values. */ @@ -328,7 +327,7 @@ struct yasl_private_pointer_pen { enum yasl_private_event_type { YASL_PRIVATE_EVENT_NONE = 0, - /* Input: produced by backends, returned by yasl_private_surface_poll_event(). */ + /* Input: produced by backends and consumed from the display FIFO. */ YASL_PRIVATE_EVENT_KEY, /**< .key */ YASL_PRIVATE_EVENT_TEXT, /**< .text — committed UTF-8; insert this, not key codepoints. */ YASL_PRIVATE_EVENT_POINTER_DOWN, /**< .pointer — button/tip pressed; button valid. */ @@ -337,12 +336,11 @@ enum yasl_private_event_type { YASL_PRIVATE_EVENT_POINTER_SCROLL, /**< .pointer — scroll valid. */ YASL_PRIVATE_EVENT_POINTER_LEAVE, /**< .pointer — last known pos/device; cancel hover state. */ YASL_PRIVATE_EVENT_FOCUS, /**< .focus — keyboard focus changed; cancel held state on loss. */ - YASL_PRIVATE_EVENT_PASTE, /**< .text — UTF-8 from yasl_private_display_paste(). */ + YASL_PRIVATE_EVENT_PASTE, /**< .paste — clipboard request completion. */ YASL_PRIVATE_EVENT_DROP, /**< .text — dropped text/uri-list: CRLF-separated file URLs, not paths. */ YASL_PRIVATE_EVENT_INPUT_RESET, /**< No payload. Input stream interrupted; clear held keys, buttons, strokes, IME. */ - /* Window and application: part of the display FIFO, as well as runner delivery. - * Legacy window callbacks also receive matching native notifications. */ + /* Window and application notifications in the display FIFO. */ YASL_PRIVATE_EVENT_WINDOW_RESIZE, /**< .resize — size and/or scale changed; reallocate and redraw. */ YASL_PRIVATE_EVENT_WINDOW_CLOSE, /**< No payload. User asked to close the window. */ YASL_PRIVATE_EVENT_USER, /**< .user — posted application message. */ @@ -414,7 +412,7 @@ struct yasl_private_pointer_event { /** Borrowed NUL-terminated UTF-8, shared by TEXT, PASTE and DROP. */ struct yasl_private_text_event { - /** Borrowed NUL-terminated bytes; see yasl_private_surface_poll_event() for lifetime. */ + /** Borrowed NUL-terminated bytes; valid until the next successful display poll or display close. */ const char *data; /** Length in bytes excluding the terminating NUL. */ size_t len; @@ -427,11 +425,11 @@ enum yasl_private_transfer_status { YASL_PRIVATE_TRANSFER_FAILED, /**< Transfer or decoding failed. */ }; -/** Clipboard completion; data/len alias the legacy text payload. */ +/** Clipboard completion; data/len share the text payload layout. */ struct yasl_private_paste_event { const char *data; /**< Borrowed NUL-terminated UTF-8; empty on failure. */ size_t len; /**< Byte length excluding NUL. */ - uint64_t request_id; /**< Zero for a legacy paste request. */ + uint64_t request_id; /**< Nonzero clipboard request identity. */ enum yasl_private_transfer_status status; /**< Completion outcome. */ }; @@ -511,7 +509,7 @@ struct yasl_private_event { struct { const char *data; size_t len; uint64_t revision, generation; size_t begin, end; } text_edit; struct yasl_private_key_event key; /**< KEY */ struct yasl_private_pointer_event pointer; /**< POINTER_* */ - struct yasl_private_text_event text; /**< TEXT, legacy PASTE, DROP */ + struct yasl_private_text_event text; /**< TEXT, DROP */ struct yasl_private_paste_event paste; /**< PASTE */ struct yasl_private_composition_event composition; /**< COMPOSITION */ struct yasl_private_state_event state; /**< WINDOW_STATE */ @@ -534,35 +532,9 @@ struct yasl_private_event { */ /* Callbacks */ -/** Optional display notifications. NULL callback members are ignored. */ -struct yasl_private_display_cbs { - /** Application quit request; arrange orderly shutdown after dispatch returns. */ - void (*quit)(void *ud); - /** Application reopen/activation request, currently Cocoa. */ - void (*reopen)(void *ud); - /** Display connection lost; arrange cleanup after dispatch returns. */ - void (*lost)(void *ud); -}; - -/** Optional window/popup notifications, copied from yasl_private_window_spec.cbs or by -yasl_private_surface_set_callbacks(). -Callbacks may destroy their surface. They must then return without further use -of the surface or draw target. NULL members are ignored. */ +/** Internal CPU presenter callback, copied on installation. */ struct yasl_private_window_cbs { - /** Initialize the entire target and optionally present. Requested through schedule_redraw/flush. */ void (*draw)(struct yasl_surface *s, struct yasl_private_frame *frame, void *ud); - /** Configured size/scale changed; reallocate application content and request a redraw. */ - void (*configure)(struct yasl_surface *s, struct yasl_private_geometry geometry, void *ud); - /** Window/popup close request; application is responsible for destruction. */ - void (*close)(struct yasl_surface *s, void *ud); - /** Reported yasl_private_surface_state bitmask changed; matches yasl_private_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_private_drag_event ev, - struct yasl_private_vector2i pos, void *ud); - /** External data-drag hover or leave; pos is in device pixels. */ - void (*drop)(struct yasl_surface *s, enum yasl_private_drop_event ev, - struct yasl_private_vector2i pos, void *ud); }; /* Display Lifecycle */ @@ -578,10 +550,6 @@ enum yasl_private_backend { struct yasl_private_display_spec { /** Copied application identifier, conventionally a reverse-domain UTF-8 string; NULL uses backend defaults. */ const char *app_id; - /** Copied optional display callbacks; NULL disables them. */ - const struct yasl_private_display_cbs *cbs; - /** Borrowed display callback userdata. */ - void *ud; /** Zero/AUTO chooses native backend; explicit choices never fall back. */ enum yasl_private_backend backend; @@ -661,26 +629,6 @@ int yasl_private_display_modifiers(const struct yasl_private_display *d); * rather than on every click. */ int yasl_private_display_double_click_ms(const struct yasl_private_display *d); -/* Unsupported/invalid selections are no-ops, never clipboard aliases. */ -/** - * Offer a copy of a NUL-terminated UTF-8 string as a selection. - * @param d Display, or NULL for no action. - * @param sel YASL_PRIVATE_CLIPBOARD or YASL_PRIVATE_PRIMARY. - * @param text Text copied during this call; NULL does nothing. - * Unsupported selections do nothing. The void return does not confirm that the - * system accepted the offer; Wayland may require a recent input serial. - */ -void yasl_private_display_copy(struct yasl_private_display *d, enum yasl_private_selection sel, const char *text); -/** - * Request text delivery to a particular surface. - * @param d Display that owns target. - * @param sel YASL_PRIVATE_CLIPBOARD or YASL_PRIVATE_PRIMARY. - * @param target Destination surface; NULL or a surface on another display does nothing. - * Results arrive as YASL_PRIVATE_EVENT_PASTE, possibly during a later dispatch. No result - * is promised for unavailable data or a failed transfer. Destroying target cancels - * delivery. Unsupported selections do nothing. - */ -void yasl_private_display_paste(struct yasl_private_display *d, enum yasl_private_selection sel, struct yasl_surface *target); /* A successful drag invokes the copied listener's non-NULL end once, including * cancel and display close. Failed starts do not invoke it. */ @@ -714,19 +662,16 @@ struct yasl_private_window_spec { /** Copied UTF-8 title; NULL uses backend defaults. */ const char *title; /** Requested logical-pixel width and height; both must be positive. */ - union { - struct yasl_private_vector2i size_logical; /**< Requested logical-pixel extent. */ - struct yasl_private_vector2i size; /**< Migration alias for size_logical. */ - }; + struct yasl_private_vector2i size; /** Request initial fullscreen; actual state is reported asynchronously. */ bool fullscreen; /** Permit unpaced presentation where supported; a hint, not a guarantee. */ bool tearing; /** Copied optional window callbacks; NULL disables them. */ const struct yasl_private_window_cbs *cbs; - /** Borrowed window callback userdata; ignored by the runner. */ + /** Borrowed CPU presenter userdata. */ void *ud; - /** Borrowed application data, independent of callbacks and available in either loop style. */ + /** Borrowed application data, independent of the CPU presenter. */ void *userdata; }; @@ -738,13 +683,10 @@ Dimensions must be positive, at most 32767, and fit an INT32_MAX-byte buffer; backends may impose further limits after scaling or resolving placement. */ struct yasl_private_popup_spec { unsigned anchor_edges, gravity, constraints; - bool positioner_explicit; /** Full popup framebuffer extent in device pixels, including transparent margins. */ struct yasl_private_vector2i size; /** Rectangle in parent framebuffer coordinates, in device pixels. */ struct yasl_private_rect2i anchor; - /** true prefers right of anchor; false prefers below. Placement may flip/slide. */ - bool beside; /** Top-left content offset within the popup, in device pixels. */ struct yasl_private_vector2i content_offset; /** Content extent; zero per axis extends to the corresponding size edge. */ @@ -761,10 +703,8 @@ struct yasl_private_popup_spec { * size may differ from the request. The callback table in spec->cbs is copied; * spec->ud stays borrowed until callbacks are replaced or the surface is destroyed. * This window's callbacks cannot run before creation returns. Use - * yasl_private_surface_geometry() for initial geometry; an initial configure callback - * is not guaranteed. Schedule an initial redraw after setting up application state. - * On a display owned by yasl_private_run(), the runner installs its own callbacks instead; - * use yasl_private_app_desc.event and yasl_private_app_desc.frame for application notifications. + * yasl_private_surface_geometry() for initial geometry. Schedule an initial redraw + * after setting up the CPU presenter. Lifecycle notifications arrive in the display FIFO. */ struct yasl_surface *yasl_private_surface_create_toplevel(struct yasl_private_display *d, const struct yasl_private_window_spec *spec); @@ -809,7 +749,7 @@ struct yasl_private_display *yasl_private_surface_display(const struct yasl_surf * @param s Surface. * @param cbs Table copied by value; NULL removes all callbacks. NULL members are ignored. * @param ud Borrowed userdata passed to the installed callbacks. - * @return true if replaced; false with EINVAL for NULL, EBUSY on a runner-owned surface. + * @return true if replaced; false with EINVAL for NULL. * This call only replaces callbacks; it does not invoke them. * Use yasl_private_surface_geometry() to read current geometry; do not rely on receiving * an initial configure callback when registering. @@ -848,18 +788,6 @@ void yasl_private_surface_schedule_redraw(struct yasl_surface *s); */ bool yasl_private_surface_present(struct yasl_surface *s, const struct yasl_private_framebuffer *fb, const struct yasl_private_damage_list *damage); -/** - * Migration adapter: consume one input event for a surface from the display FIFO. - * Popup input can belong to the root queue; inspect ev->surface. Returns false - * for empty/invalid arguments, leaving ev unchanged. Strings remain borrowed - * until the next successful display or surface poll, or display close. Pending - * recipient events are canceled on destruction. Prefer yasl_private_display_poll_event() - * to receive window, composition, and display events as well as input. This - * input-only adapter discards pending non-input events across the display - * (legacy callbacks already delivered lifecycle changes). Do not mix - * the two polling styles in one application. Use the display thread. - */ -bool yasl_private_surface_poll_event(struct yasl_surface *s, struct yasl_private_event *ev); /** * Decode the next local file path from a YASL_PRIVATE_EVENT_DROP payload. * @param cursor Required in/out position in the NUL-terminated list. Start it @@ -958,7 +886,7 @@ void yasl_private_surface_request_frame(struct yasl_surface *s); bool yasl_private_surface_set_pacing(struct yasl_surface *s, yasl_private_pacing_mode mode); /** Request a positive logical-pixel size. Success means issued, not configured. */ -bool yasl_private_surface_set_size(struct yasl_surface *s, struct yasl_private_vector2i size_logical); +bool yasl_private_surface_set_size(struct yasl_surface *s, struct yasl_private_vector2i size); /** Request fullscreen state; returns acceptance, not confirmation. */ bool yasl_private_surface_set_fullscreen(struct yasl_surface *s, bool enabled); /** Request maximized state; returns acceptance, not confirmation. */ -- cgit v1.2.3