summaryrefslogtreecommitdiff
path: root/src/platform/cocoa/api.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 23:41:31 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 23:41:31 +0300
commit76073fe5fad8799e5850805f2f090af2cb62c741 (patch)
tree9658019babe4760a3634bdab4da0731a10e42e68 /src/platform/cocoa/api.h
parentdd1775a9927922c14f8679ccbc4d3ca8d5917e20 (diff)
Simplify the public event and CPU API
Applications now need far less ceremony: hello.c is a 20-line loop that handles REFRESH, CLOSE and QUIT and draws into the surface's own pixels. - Fold GEOMETRY, STATE and FOCUS into one WINDOW event carrying size, scale and state; unchanged values send nothing. - Guarantee REFRESH once a window has a size and after every resize, never at size zero. - Merge DROP_HOVER into DROP with over/leave/data actions and give drag and drop actions enums. - Keep event strings valid until the next wait and drop yasl_event_release; empty or failed waits report NONE. - Replace copy-in presentation with a lent pixel buffer: yasl_cpu_pixels and yasl_cpu_present. - Remove yasl_poll_event, yasl_cpu_read_pixels, unused event fields and comments that restated names. - Wayland: resize floating windows in request_size instead of reporting it unsupported, and stop marking new GPU surfaces as Vulkan so yasl_vulkan_create_surface no longer fails with NATIVE_WINDOW_IN_USE. Also includes the in-progress public API refactor that was uncommitted in the tree (removal of the app/loop layer, new surface, GL and Vulkan entry points). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/platform/cocoa/api.h')
-rw-r--r--src/platform/cocoa/api.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/platform/cocoa/api.h b/src/platform/cocoa/api.h
index eaacc01..4a22410 100644
--- a/src/platform/cocoa/api.h
+++ b/src/platform/cocoa/api.h
@@ -1,40 +1,40 @@
-#ifndef YASL_COCOA_API_H
-#define YASL_COCOA_API_H
+#ifndef YASL_PRIVATE_COCOA_API_H
+#define YASL_PRIVATE_COCOA_API_H
-#include "yasl/yasl.h"
+#include "common/types.h"
struct cocoa_display;
struct cocoa_surface;
-struct cocoa_display *cocoa_display_open(struct yasl_loop *loop, const struct yasl_display_spec *spec);
+struct cocoa_display *cocoa_display_open(struct yasl_private_loop *loop, const struct yasl_private_display_spec *spec);
void cocoa_display_close(struct cocoa_display *d);
uint32_t cocoa_display_caps(const struct cocoa_display *d);
int cocoa_display_dispatch_timeout(struct cocoa_display *d, int timeout_ms);
void cocoa_display_flush(struct cocoa_display *d);
int cocoa_display_modifiers(const struct cocoa_display *d);
-void cocoa_display_copy(struct cocoa_display *d, enum yasl_selection sel, const char *text);
-void cocoa_display_paste(struct cocoa_display *d, enum yasl_selection sel, struct cocoa_surface *target);
-bool cocoa_display_drag_start(struct cocoa_display *d, struct cocoa_surface *origin, const struct yasl_drag_image *image, const struct yasl_drag_listener *l, void *ud);
+void cocoa_display_copy(struct cocoa_display *d, enum yasl_private_selection sel, const char *text);
+void cocoa_display_paste(struct cocoa_display *d, enum yasl_private_selection sel, struct cocoa_surface *target);
+bool cocoa_display_drag_start(struct cocoa_display *d, struct cocoa_surface *origin, const struct yasl_private_drag_image *image, const struct yasl_private_drag_listener *l, void *ud);
struct cocoa_surface *cocoa_surface_create_toplevel(struct cocoa_display *d,
- const struct yasl_window_spec *spec, void *graphics_device);
-struct cocoa_surface *cocoa_surface_create_popup(struct cocoa_surface *parent, const struct yasl_popup_spec *spec);
-bool cocoa_surface_popup_reposition(struct cocoa_surface *popup, const struct yasl_popup_spec *spec);
+ const struct yasl_private_window_spec *spec, void *graphics_device);
+struct cocoa_surface *cocoa_surface_create_popup(struct cocoa_surface *parent, const struct yasl_private_popup_spec *spec);
+bool cocoa_surface_popup_reposition(struct cocoa_surface *popup, const struct yasl_private_popup_spec *spec);
void cocoa_surface_destroy(struct cocoa_surface *s);
-void cocoa_surface_set_callbacks(struct cocoa_surface *s, const struct yasl_window_cbs *cbs, void *ud);
+void cocoa_surface_set_callbacks(struct cocoa_surface *s, const struct yasl_private_window_cbs *cbs, void *ud);
void cocoa_surface_set_title(struct cocoa_surface *s, const char *title);
void cocoa_surface_schedule_redraw(struct cocoa_surface *s);
-bool cocoa_surface_present(struct cocoa_surface *s, const struct yasl_framebuffer *fb, const struct yasl_damage_list *damage);
-bool cocoa_surface_poll_event(struct cocoa_surface *s, struct yasl_event *ev);
-struct yasl_geometry cocoa_surface_geometry(const struct cocoa_surface *s);
-struct yasl_timing cocoa_surface_timing(const struct cocoa_surface *s);
-void cocoa_surface_set_cursor(struct cocoa_surface *s, enum yasl_cursor cursor);
+bool cocoa_surface_present(struct cocoa_surface *s, const struct yasl_private_framebuffer *fb, const struct yasl_private_damage_list *damage);
+bool cocoa_surface_poll_event(struct cocoa_surface *s, struct yasl_private_event *ev);
+struct yasl_private_geometry cocoa_surface_geometry(const struct cocoa_surface *s);
+struct yasl_private_timing cocoa_surface_timing(const struct cocoa_surface *s);
+void cocoa_surface_set_cursor(struct cocoa_surface *s, enum yasl_private_cursor cursor);
void cocoa_surface_set_background_color(struct cocoa_surface *s, uint32_t bg);
bool cocoa_surface_ime_preedit_cursor(const struct cocoa_surface *s, int *begin, int *end);
-void cocoa_surface_set_ime_caret(struct cocoa_surface *s, struct yasl_rect2i caret);
+void cocoa_surface_set_ime_caret(struct cocoa_surface *s, struct yasl_private_rect2i caret);
bool cocoa_surface_start_interactive_move(struct cocoa_surface *s);
-bool cocoa_surface_start_interactive_resize(struct cocoa_surface *s, enum yasl_resize_edge edge);
-bool cocoa_surface_show_window_menu(struct cocoa_surface *s, struct yasl_vector2i pos);
-bool cocoa_surface_drag_carry(struct cocoa_surface *s, struct yasl_vector2i offset);
-bool cocoa_surface_place_under_pointer(struct cocoa_surface *s, struct yasl_vector2i at);
+bool cocoa_surface_start_interactive_resize(struct cocoa_surface *s, enum yasl_private_resize_edge edge);
+bool cocoa_surface_show_window_menu(struct cocoa_surface *s, struct yasl_private_vector2i pos);
+bool cocoa_surface_drag_carry(struct cocoa_surface *s, struct yasl_private_vector2i offset);
+bool cocoa_surface_place_under_pointer(struct cocoa_surface *s, struct yasl_private_vector2i at);
#endif