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/common/test_input_alloc.c | |
| 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/common/test_input_alloc.c')
| -rw-r--r-- | tests/common/test_input_alloc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/common/test_input_alloc.c b/tests/common/test_input_alloc.c index 7aba4b2..12e7656 100644 --- a/tests/common/test_input_alloc.c +++ b/tests/common/test_input_alloc.c @@ -5,7 +5,7 @@ /* This executable compiles input.c with malloc redirected here. */ static int allocations = -1; -void *yasl_test_malloc(size_t bytes) +void *yasl_private_test_malloc(size_t bytes) { if (allocations == 0) return NULL; if (allocations > 0) allocations--; @@ -13,19 +13,19 @@ void *yasl_test_malloc(size_t bytes) } /* input.c timestamps events, but this executable links no event loop. */ -uint64_t yasl_loop_now_ns(void) { return 1; } +uint64_t yasl_private_loop_now_ns(void) { return 1; } int main(void) { struct yasl_surface *surface = (struct yasl_surface *)(uintptr_t)1; for (int failure = 0; failure < 2; failure++) { struct input_queue q = {0}; - struct yasl_event in = {.surface = surface, .type = YASL_EVENT_PASTE, + struct yasl_private_event in = {.surface = surface, .type = YASL_PRIVATE_EVENT_PASTE, .text = {"payload", 7}}, out; /* Fail either payload allocation or the initial event-array allocation. */ allocations = failure; assert(!input_queue_push(&q, &in)); - assert(input_queue_pop(&q, &out) && out.type == YASL_EVENT_INPUT_RESET); + assert(input_queue_pop(&q, &out) && out.type == YASL_PRIVATE_EVENT_INPUT_RESET); assert(out.surface == surface); assert(!input_queue_pop(&q, &out)); input_queue_clear(&q); @@ -40,15 +40,15 @@ int main(void) assert(strcmp(last, "payload") == 0); assert(!q.count && q.reset_pending); allocations = -1; - in = (struct yasl_event){.surface = surface, .type = YASL_EVENT_KEY, + in = (struct yasl_private_event){.surface = surface, .type = YASL_PRIVATE_EVENT_KEY, .key.action = YASL_KEY_RELEASE}; assert(input_queue_push(&q, &in)); - assert(input_queue_pop(&q, &out) && out.type == YASL_EVENT_INPUT_RESET); + assert(input_queue_pop(&q, &out) && out.type == YASL_PRIVATE_EVENT_INPUT_RESET); assert(input_queue_pop(&q, &out) && out.key.action == YASL_KEY_RELEASE); input_queue_clear(&q); /* A lost event clears held buttons along with the stream. */ - in = (struct yasl_event){.surface = surface, .type = YASL_EVENT_POINTER_DOWN}; + in = (struct yasl_private_event){.surface = surface, .type = YASL_PRIVATE_EVENT_POINTER_DOWN}; assert(input_queue_push(&q, &in) && q.buttons); for (size_t i = 1; i < q.capacity; i++) assert(input_queue_push(&q, &in)); allocations = 0; |
