summaryrefslogtreecommitdiff
path: root/src/cocoa/api.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-11 23:51:43 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-11 23:51:43 +0300
commite813252e685d761235ad45e170d97c9375f51958 (patch)
treee57bae545c0eb22aac4119a890b8344ee7cd09d2 /src/cocoa/api.h
parent608b49052178ea74f593c925cdeedf352aa1c357 (diff)
parent6eac0a5f2c552728efca420b1129fae7d4fea773 (diff)
Merge branch 'backend-selection' into main
- Implement runtime backend selection (Wayland, X11, Cocoa) - Add native X11 backend with clipboard, keyboard, mouse, and placement - Integrate multi-backend integration tests running under Weston and Xwayland - Retain zero-hole struct packing, branchless ALU/LUT primitives, and paced event loop
Diffstat (limited to 'src/cocoa/api.h')
-rw-r--r--src/cocoa/api.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/cocoa/api.h b/src/cocoa/api.h
new file mode 100644
index 0000000..2fea415
--- /dev/null
+++ b/src/cocoa/api.h
@@ -0,0 +1,48 @@
+#ifndef YASL_COCOA_API_H
+#define YASL_COCOA_API_H
+
+#include "common/backend.h"
+
+struct cocoa_display;
+struct cocoa_surface;
+
+struct cocoa_display *cocoa_display_open(struct yasl_loop *loop, const struct yasl_display_spec *spec);
+void cocoa_display_close(struct cocoa_display *d);
+uint32_t cocoa_display_caps(const struct cocoa_display *d);
+void cocoa_display_dispatch(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_drag_cancel(struct cocoa_display *d);
+struct cocoa_surface *cocoa_surface_create_toplevel(struct cocoa_display *d, const struct yasl_surface_spec *spec);
+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);
+void cocoa_surface_destroy(struct cocoa_surface *s);
+struct cocoa_display *cocoa_surface_display(const struct cocoa_surface *s);
+void cocoa_surface_set_callbacks(struct cocoa_surface *s, const struct yasl_surface_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_input_poll(struct cocoa_surface *s, struct yasl_input_event *ev);
+struct yasl_vector2i cocoa_surface_size(const struct cocoa_surface *s);
+uint32_t cocoa_surface_scale_120(const struct cocoa_surface *s);
+uint32_t cocoa_surface_state(const struct cocoa_surface *s);
+struct yasl_timing cocoa_surface_timing(const struct cocoa_surface *s);
+uint64_t cocoa_surface_frame_time_ns(struct cocoa_surface *s, uint64_t now);
+void cocoa_surface_set_cursor(struct cocoa_surface *s, enum yasl_cursor cursor);
+void cocoa_surface_set_background_color(struct cocoa_surface *s, uint32_t bg);
+const char *cocoa_surface_ime_preedit(const struct cocoa_surface *s);
+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);
+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);
+void *cocoa_display_get_native_handle(struct cocoa_display *d);
+void *cocoa_surface_get_native_handle(struct cocoa_surface *s);
+
+#endif