From ff9169c4d1609afa58b9c265849456e3106d0894 Mon Sep 17 00:00:00 2001 From: bynect <68197565+bynect@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:13:15 +0200 Subject: [PATCH] Scale wayland input coordinates --- src/wayland/wl_seat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wayland/wl_seat.c b/src/wayland/wl_seat.c index ffc1e48be..10bc6c643 100644 --- a/src/wayland/wl_seat.c +++ b/src/wayland/wl_seat.c @@ -50,8 +50,10 @@ static void touch_handle_up(void *data, struct wl_touch *wl_touch, if (id >= MAX_TOUCHPOINTS) { return; } + + double scale = wl_get_scale(); input_handle_click(BTN_TOUCH, false, - seat->touch.pts[id].x, seat->touch.pts[id].y); + seat->touch.pts[id].x/scale, seat->touch.pts[id].y/scale); } @@ -100,7 +102,8 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, uint32_t button_state) { struct dunst_seat *seat = data; - input_handle_click(button, button_state, seat->pointer.x, seat->pointer.y); + double scale = wl_get_scale(); + input_handle_click(button, button_state, seat->pointer.x/scale, seat->pointer.y/scale); } static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,