input: take scale into account when converting mouse coords to row/col

This commit is contained in:
Daniel Eklöf 2019-08-30 21:31:14 +02:00
parent 05888b4706
commit 37d941f57a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -404,8 +404,9 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
{
struct terminal *term = data;
int x = wl_fixed_to_int(surface_x) * 1;//backend->monitor->scale;
int y = wl_fixed_to_int(surface_y) * 1;//backend->monitor->scale;
const int scale = term->scale >= 1 ? term->scale : 1;
int x = wl_fixed_to_int(surface_x) * scale;
int y = wl_fixed_to_int(surface_y) * scale;
int col = (x - term->x_margin) / term->cell_width;
int row = (y - term->y_margin) / term->cell_height;