mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-08 08:20:59 -04:00
input: bug: account for margins when converting mouse coords to row/col
This commit is contained in:
parent
7c4c41fbae
commit
05888b4706
1 changed files with 2 additions and 2 deletions
4
input.c
4
input.c
|
|
@ -407,8 +407,8 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
||||||
int x = wl_fixed_to_int(surface_x) * 1;//backend->monitor->scale;
|
int x = wl_fixed_to_int(surface_x) * 1;//backend->monitor->scale;
|
||||||
int y = wl_fixed_to_int(surface_y) * 1;//backend->monitor->scale;
|
int y = wl_fixed_to_int(surface_y) * 1;//backend->monitor->scale;
|
||||||
|
|
||||||
int col = x / term->cell_width;
|
int col = (x - term->x_margin) / term->cell_width;
|
||||||
int row = y / term->cell_height;
|
int row = (y - term->y_margin) / term->cell_height;
|
||||||
|
|
||||||
if (col < 0 || row < 0 || col >= term->cols || row >= term->rows)
|
if (col < 0 || row < 0 || col >= term->cols || row >= term->rows)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue