aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-30 19:31:14 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-30 19:31:14 +0000
commit37d941f57ad279407de97ee736ac2a22fe1e0b66 (patch)
tree699b84635bbb3652b0c1c8685f99a3cd623af73d
parentinput: bug: account for margins when converting mouse coords to row/col (diff)
input: take scale into account when converting mouse coords to row/col
-rw-r--r--input.c5
1 files 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;