aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2026-08-29 17:44:29 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-08-29 17:58:56 +0000
commit765ca4070bb6f095fc58c030f2154ed03857701d (patch)
tree165aa959db1978208a084c820cb1e7c7c8c5c40b /input.c
parentinput: ignore keyboard_enter() with NULL surface (diff)
render: re-evaluate mouse col/row coordinates after a window resize
Before this, the col/row coordinates for the mouse pointer was only updated when the mouse either entered our window, or was moved inside it. However, when a window is resized without using the mouse, and the user then clicks (again, without moving the mouse), we can get a button event outside the cell grid, that we still think is on top of the grid. Example: user moves mouse over the bottom row. The window is shrunk. Enough that the mouse is now outside the cell grid, but still inside our window. This means we get a button event outside the grid. But since we haven't updated the col/row coordinates, we think it's on a row, that no longer exists. Closes #2435
Diffstat (limited to 'input.c')
-rw-r--r--input.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/input.c b/input.c
index 74cd320f..e11b86db 100644
--- a/input.c
+++ b/input.c
@@ -2417,12 +2417,12 @@ mouse_button_state_reset(struct seat *seat)
memset(&seat->mouse.last_time, 0, sizeof(seat->mouse.last_time));
}
-static void
+ void
mouse_coord_pixel_to_cell(struct seat *seat, const struct terminal *term,
int x, int y)
{
/*
- * Translate x,y pixel coordinate to a cell coordinate, or -1
+ * Translate x,y pixel coordinate to a cell coordinate, or clamp
* if the cursor is outside the grid. I.e. if it is inside the
* margins.
*/