summaryrefslogtreecommitdiff
path: root/tests/wayland/test_relative_pointer.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_relative_pointer.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_relative_pointer.c')
-rw-r--r--tests/wayland/test_relative_pointer.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/wayland/test_relative_pointer.c b/tests/wayland/test_relative_pointer.c
index bcc41e3..d44238d 100644
--- a/tests/wayland/test_relative_pointer.c
+++ b/tests/wayland/test_relative_pointer.c
@@ -65,10 +65,10 @@ static void shape_device_destroy(struct wp_cursor_shape_device_v1 *device) { ass
#define wl_pointer_release pointer_release
#include "../../src/platform/wayland/pointer.c"
-static struct yasl_event next_event(struct wayland_surface *w)
+static struct yasl_private_event next_event(struct wayland_surface *w)
{
- struct yasl_event event;
- assert(yasl_surface_poll_event(&w->base, &event));
+ struct yasl_private_event event;
+ assert(yasl_private_surface_poll_event(&w->base, &event));
return event;
}
@@ -85,9 +85,9 @@ static void relative_move(struct seat *s, double dx, double dy)
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 = 2, .cursor = YASL_CURSOR_TEXT};
+ .scale_factor = 2, .cursor = YASL_PRIVATE_CURSOR_TEXT};
surface.surface = (struct wl_surface *)&surface;
wl_surface_set_user_data(surface.surface, &surface);
display.surfaces = &surface;
@@ -95,10 +95,10 @@ int main(void)
seat.pointer = (struct wl_pointer *)&seat;
seat.cursor_shape_dev = (struct wp_cursor_shape_device_v1 *)&seat;
display.seats = &seat;
- struct yasl_event event;
+ struct yasl_private_event event;
/* Without both protocols the surface stays in absolute mode. */
- assert(!yasl_surface_set_pointer_mode(&surface.base, YASL_POINTER_RELATIVE));
+ assert(!yasl_private_surface_set_pointer_mode(&surface.base, YASL_PRIVATE_POINTER_RELATIVE));
assert(!surface.relative && !locks);
display.relative_pointer_mgr = (struct zwp_relative_pointer_manager_v1 *)&display;
display.pointer_constraints = (struct zwp_pointer_constraints_v1 *)&display;
@@ -107,10 +107,10 @@ int main(void)
pointer_frame(&seat, seat.pointer);
assert(pointer_shapes == 1);
event = next_event(&surface);
- assert(event.type == YASL_EVENT_POINTER_MOTION && event.pointer.pos.x == 10);
+ assert(event.type == YASL_PRIVATE_EVENT_POINTER_MOTION && event.pointer.pos.x == 10);
/* Relative mode locks persistently on the pointer's seat and hides the cursor. */
- assert(yasl_surface_set_pointer_mode(&surface.base, YASL_POINTER_RELATIVE));
+ assert(yasl_private_surface_set_pointer_mode(&surface.base, YASL_PRIVATE_POINTER_RELATIVE));
assert(locks == 1 && locked_surface == surface.surface && locked_wl_pointer == seat.pointer);
assert(lock_lifetime == ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
assert(pointer_hides == 1 && surface.lock_seat == &seat);
@@ -121,14 +121,14 @@ int main(void)
event = next_event(&surface);
assert(event.pointer.pos.x == 14 && event.pointer.pos.y == 10);
assert(event.pointer.delta.x == 4 && event.pointer.delta.y == 0);
- assert(!yasl_surface_poll_event(&surface.base, &event));
+ assert(!yasl_private_surface_poll_event(&surface.base, &event));
/* Locked: relative samples in device pixels, position frozen at the lock. */
pointer_locked(&surface, surface.pointer_lock);
relative_move(&seat, 3.5, -2);
relative_move(&seat, 1000, 0);
event = next_event(&surface);
- assert(event.type == YASL_EVENT_POINTER_MOTION);
+ assert(event.type == YASL_PRIVATE_EVENT_POINTER_MOTION);
assert(event.pointer.pos.x == 14 && event.pointer.pos.y == 10);
assert(event.pointer.delta.x == 7 && event.pointer.delta.y == -4);
event = next_event(&surface);
@@ -137,7 +137,7 @@ int main(void)
/* Deactivation (e.g. focus loss) returns to absolute motion without unlocking. */
pointer_unlocked(&surface, surface.pointer_lock);
relative_move(&seat, 5, 5);
- assert(!yasl_surface_poll_event(&surface.base, &event));
+ assert(!yasl_private_surface_poll_event(&surface.base, &event));
move_to(&seat, 8, 5);
event = next_event(&surface);
assert(event.pointer.delta.x == 2 && event.pointer.delta.y == 0);
@@ -145,12 +145,12 @@ int main(void)
pointer_locked(&surface, surface.pointer_lock);
/* Returning to normal destroys the lock and restores the chosen cursor. */
- assert(yasl_surface_set_pointer_mode(&surface.base, YASL_POINTER_NORMAL));
+ assert(yasl_private_surface_set_pointer_mode(&surface.base, YASL_PRIVATE_POINTER_NORMAL));
assert(unlocks == 1 && !surface.pointer_lock && !surface.input.relative);
assert(pointer_shapes == 2);
- assert(yasl_surface_set_pointer_mode(&surface.base, YASL_POINTER_NORMAL));
+ assert(yasl_private_surface_set_pointer_mode(&surface.base, YASL_PRIVATE_POINTER_NORMAL));
assert(unlocks == 1);
- assert(yasl_surface_set_pointer_mode(&surface.base, YASL_POINTER_RELATIVE));
+ assert(yasl_private_surface_set_pointer_mode(&surface.base, YASL_PRIVATE_POINTER_RELATIVE));
assert(locks == 2 && pointer_hides == 2);
pointer_locked(&surface, surface.pointer_lock);