mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-31 07:11:09 -04:00
input: take scale into account when converting mouse coords to row/col
This commit is contained in:
parent
05888b4706
commit
37d941f57a
1 changed files with 3 additions and 2 deletions
5
input.c
5
input.c
|
|
@ -404,8 +404,9 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
||||||
{
|
{
|
||||||
struct terminal *term = data;
|
struct terminal *term = data;
|
||||||
|
|
||||||
int x = wl_fixed_to_int(surface_x) * 1;//backend->monitor->scale;
|
const int scale = term->scale >= 1 ? term->scale : 1;
|
||||||
int y = wl_fixed_to_int(surface_y) * 1;//backend->monitor->scale;
|
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 col = (x - term->x_margin) / term->cell_width;
|
||||||
int row = (y - term->y_margin) / term->cell_height;
|
int row = (y - term->y_margin) / term->cell_height;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue