diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 23:41:31 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 23:41:31 +0300 |
| commit | 76073fe5fad8799e5850805f2f090af2cb62c741 (patch) | |
| tree | 9658019babe4760a3634bdab4da0731a10e42e68 /tests/cocoa/test_cursor.m | |
| parent | dd1775a9927922c14f8679ccbc4d3ca8d5917e20 (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 'tests/cocoa/test_cursor.m')
| -rw-r--r-- | tests/cocoa/test_cursor.m | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/cocoa/test_cursor.m b/tests/cocoa/test_cursor.m index 4054d59..4c961df 100644 --- a/tests/cocoa/test_cursor.m +++ b/tests/cocoa/test_cursor.m @@ -1,5 +1,5 @@ #import <AppKit/AppKit.h> -#include <yasl/native.h> +#include <common/private_native.h> #include <assert.h> static void assert_transparent(NSCursor *cursor) @@ -15,18 +15,18 @@ static void assert_transparent(NSCursor *cursor) int main(void) { @autoreleasepool { - struct yasl_display *display = yasl_display_open(NULL, NULL); + struct yasl_private_display *display = yasl_private_display_open(NULL, NULL); assert(display); - struct yasl_window_spec spec = {.title = "Cursor test", .size = {320, 240}}; - struct yasl_surface *surface = yasl_surface_create_toplevel(display, &spec); + struct yasl_private_window_spec spec = {.title = "Cursor test", .size = {320, 240}}; + struct yasl_surface *surface = yasl_private_surface_create_toplevel(display, &spec); assert(surface); - NSWindow *window = (NSWindow *)yasl_surface_get_native_handle(surface); + NSWindow *window = (NSWindow *)yasl_private_surface_get_native_handle(surface); NSView *view = window.contentView; NSEvent *cursor = [NSEvent enterExitEventWithType:NSEventTypeCursorUpdate location:NSMakePoint(100, 120) modifierFlags:0 timestamp:0 windowNumber:window.windowNumber context:nil eventNumber:0 trackingNumber:0 userData:NULL]; assert(cursor); - yasl_surface_set_cursor(surface, YASL_CURSOR_HIDDEN); + yasl_private_surface_set_cursor(surface, YASL_PRIVATE_CURSOR_HIDDEN); [view cursorUpdate:cursor]; NSCursor *hidden = [NSCursor currentCursor]; assert_transparent(hidden); @@ -37,21 +37,21 @@ int main(void) [view mouseMoved:motion]; [view cursorUpdate:cursor]; assert([NSCursor currentCursor] == hidden); - struct yasl_event event; + struct yasl_private_event event; bool moved = false; - while (yasl_surface_poll_event(surface, &event)) - if (event.type == YASL_EVENT_POINTER_MOTION) + while (yasl_private_surface_poll_event(surface, &event)) + if (event.type == YASL_PRIVATE_EVENT_POINTER_MOTION) moved = true; assert(moved); [[NSCursor arrowCursor] set]; /* Simulate leaving and re-entering. */ [view cursorUpdate:cursor]; assert([NSCursor currentCursor] == hidden); - yasl_surface_set_cursor(surface, YASL_CURSOR_ARROW); + yasl_private_surface_set_cursor(surface, YASL_PRIVATE_CURSOR_ARROW); [view cursorUpdate:cursor]; assert([NSCursor currentCursor] == [NSCursor arrowCursor]); - yasl_surface_destroy(surface); - yasl_display_close(display); + yasl_private_surface_destroy(surface); + yasl_private_display_close(display); } return 0; } |
