summaryrefslogtreecommitdiff
path: root/tests/wayland/test_cursor.c
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 /tests/wayland/test_cursor.c
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 'tests/wayland/test_cursor.c')
-rw-r--r--tests/wayland/test_cursor.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/wayland/test_cursor.c b/tests/wayland/test_cursor.c
index eb729a3..3425821 100644
--- a/tests/wayland/test_cursor.c
+++ b/tests/wayland/test_cursor.c
@@ -51,9 +51,9 @@ static uint32_t pointer_version(struct wl_pointer *pointer)
int main(void)
{
- struct wayland_display display = {.base.ops = &yasl_wayland_backend};
+ struct wayland_display display = {.base.ops = &yasl_private_wayland_backend};
struct wayland_surface surface = {.base.display = &display.base, .conn = &display,
- .scale_factor = 1, .cursor = YASL_CURSOR_TEXT};
+ .scale_factor = 1, .cursor = YASL_PRIVATE_CURSOR_TEXT};
surface.surface = (struct wl_surface *)&surface;
wl_surface_set_user_data(surface.surface, &surface);
display.surfaces = &surface;
@@ -64,7 +64,7 @@ int main(void)
tool.proxy = (struct zwp_tablet_tool_v2 *)&tool;
/* The example selects hidden before either input device has entered. */
- yasl_surface_set_cursor(&surface.base, YASL_CURSOR_HIDDEN);
+ yasl_private_surface_set_cursor(&surface.base, YASL_PRIVATE_CURSOR_HIDDEN);
assert(!pointer_hides && !tool_hides);
pointer_enter(&seat, seat.pointer, 10, surface.surface, 0, 0);
assert(pointer_hides == 1 && pointer_serial == 10);
@@ -76,14 +76,16 @@ int main(void)
pointer_frame(&seat, seat.pointer);
tablet_tool_motion(&tool, tool.proxy, wl_fixed_from_int(56), wl_fixed_from_int(78));
tool_frame(&tool, tool.proxy, 0);
- struct yasl_event event;
- assert(yasl_surface_poll_event(&surface.base, &event));
- assert(event.type == YASL_EVENT_POINTER_MOTION && event.pointer.device == YASL_PTR_DEV_MOUSE);
+ struct yasl_private_event event;
+ assert(yasl_private_surface_poll_event(&surface.base, &event));
+ assert(event.type == YASL_PRIVATE_EVENT_POINTER_MOTION && event.pointer.device == YASL_PRIVATE_PTR_DEV_MOUSE);
assert(event.pointer.pos.x == 12 && event.pointer.pos.y == 34);
- assert(yasl_surface_poll_event(&surface.base, &event));
- assert(event.type == YASL_EVENT_POINTER_MOTION && event.pointer.device == YASL_PTR_DEV_PEN);
+ assert(yasl_private_surface_poll_event(&surface.base, &event));
+ assert(event.type == YASL_PRIVATE_EVENT_PEN && event.pen.action == YASL_PRIVATE_PEN_ENTER);
+ assert(yasl_private_surface_poll_event(&surface.base, &event));
+ assert(event.type == YASL_PRIVATE_EVENT_POINTER_MOTION && event.pointer.device == YASL_PRIVATE_PTR_DEV_PEN);
assert(event.pointer.pos.x == 56 && event.pointer.pos.y == 78);
- assert(!yasl_surface_poll_event(&surface.base, &event));
+ assert(!yasl_private_surface_poll_event(&surface.base, &event));
/* Each new entry needs a request with its own serial. */
pointer_leave(&seat, seat.pointer, 12, surface.surface);
@@ -98,20 +100,20 @@ int main(void)
/* Restore a visible shape on both currently focused devices. */
pointer_device = seat.cursor_shape_dev = (struct wp_cursor_shape_device_v1 *)&seat;
tool.shape_dev = (struct wp_cursor_shape_device_v1 *)&tool;
- yasl_surface_set_cursor(&surface.base, YASL_CURSOR_ARROW);
+ yasl_private_surface_set_cursor(&surface.base, YASL_PRIVATE_CURSOR_ARROW);
assert(pointer_shapes == 1 && tool_shapes == 1);
assert(pointer_shape == WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT);
assert(tool_shape == WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT);
- yasl_surface_set_cursor(&surface.base, YASL_CURSOR_HIDDEN);
+ yasl_private_surface_set_cursor(&surface.base, YASL_PRIVATE_CURSOR_HIDDEN);
assert(pointer_hides == 3 && tool_hides == 3);
assert(pointer_shapes == 1 && tool_shapes == 1);
/* Updating an unfocused surface must not alter the active cursor. */
struct wayland_surface other = {.base.display = &display.base, .conn = &display};
- yasl_surface_set_cursor(&other.base, YASL_CURSOR_CROSSHAIR);
+ yasl_private_surface_set_cursor(&other.base, YASL_PRIVATE_CURSOR_CROSSHAIR);
assert(pointer_shapes == 1 && tool_shapes == 1);
- yasl_surface_set_cursor(&surface.base, (enum yasl_cursor)-1);
- yasl_surface_set_cursor(&surface.base, (enum yasl_cursor)(YASL_CURSOR_HIDDEN + 1));
+ yasl_private_surface_set_cursor(&surface.base, (enum yasl_private_cursor)-1);
+ yasl_private_surface_set_cursor(&surface.base, (enum yasl_private_cursor)(YASL_PRIVATE_CURSOR_HIDDEN + 1));
assert(pointer_hides == 3 && tool_hides == 3);
assert(pointer_shapes == 1 && tool_shapes == 1);
input_queue_clear(&surface.input);