summaryrefslogtreecommitdiff
path: root/tests/x11/test_tablet_native.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/x11/test_tablet_native.c')
-rw-r--r--tests/x11/test_tablet_native.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/tests/x11/test_tablet_native.c b/tests/x11/test_tablet_native.c
index 078606a..b0d1366 100644
--- a/tests/x11/test_tablet_native.c
+++ b/tests/x11/test_tablet_native.c
@@ -70,32 +70,12 @@ static void native_draw(struct yasl_surface *surface, struct yasl_frame *frame,
static void native_configure(struct yasl_surface *surface, struct yasl_geometry geometry, void *ud)
{
input(ud, &(struct yasl_event){.surface = surface, .type = YASL_EVENT_WINDOW_RESIZE,
- .resize = {.size = geometry.size, .scale_120 = geometry.scale_120}});
+ .resize = {.geometry = geometry}});
}
-static void native_input(struct app *app, const struct yasl_input_event *raw)
+static void native_input(struct app *app, const struct yasl_event *event)
{
- struct yasl_event event = {.surface = raw->surface};
- if (raw->kind == YASL_INPUT_RESET) event.type = YASL_EVENT_INPUT_RESET;
- else if (raw->kind == YASL_INPUT_FOCUS) {
- event.type = YASL_EVENT_WINDOW_FOCUS;
- event.focus.focused = raw->focus.focused;
- } else if (raw->kind == YASL_INPUT_MOUSE) {
- if (raw->mouse.kind == YASL_PTR_MOTION) {
- event.type = YASL_EVENT_MOUSE_MOTION;
- event.mouse_motion.pos = raw->mouse.pos;
- event.mouse_motion.device = raw->mouse.device;
- event.mouse_motion.pen = raw->mouse.pen;
- } else if (raw->mouse.kind == YASL_PTR_PRESS || raw->mouse.kind == YASL_PTR_RELEASE) {
- event.type = YASL_EVENT_MOUSE_BUTTON;
- event.mouse_button.pos = raw->mouse.pos;
- event.mouse_button.device = raw->mouse.device;
- event.mouse_button.button = raw->mouse.button;
- event.mouse_button.pressed = raw->mouse.kind == YASL_PTR_PRESS;
- event.mouse_button.pen = raw->mouse.pen;
- } else if (raw->mouse.kind == YASL_PTR_LEAVE) event.type = YASL_EVENT_MOUSE_LEAVE;
- }
- input(app, &event);
+ input(app, event);
}
static void pump(int fd, struct yasl_display *display, struct yasl_surface *surface, struct app *app)
@@ -109,8 +89,8 @@ static void pump(int fd, struct yasl_display *display, struct yasl_surface *surf
* Round-trip on YASL's X connection before draining its event queue. */
XSync(yasl_display_get_native_handle(display), False);
assert(yasl_display_dispatch(display, 0) == 0);
- struct yasl_input_event event;
- while (yasl_surface_input_poll(surface, &event)) {
+ struct yasl_event event;
+ while (yasl_surface_poll_event(surface, &event)) {
native_input(app, &event);
yasl_surface_schedule_redraw(surface);
}