From 37d941f57ad279407de97ee736ac2a22fe1e0b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 30 Aug 2019 21:31:14 +0200 Subject: [PATCH] input: take scale into account when converting mouse coords to row/col --- input.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/input.c b/input.c index 07809cfe..d2c85ea3 100644 --- a/input.c +++ b/input.c @@ -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;