Skip to content

Commit

Permalink
Scale wayland input coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
bynect committed Apr 16, 2024
1 parent 6fa62cc commit ff9169c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/wayland/wl_seat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ff9169c

Please sign in to comment.