From 0a2fcf1805835e9e185c612b08813011b97f8975 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Dec 2023 22:27:20 +0530 Subject: [PATCH] Mouse reporting: Fix incorrect position reported for windows with padding Fixes #6950 --- docs/changelog.rst | 2 ++ kitty/mouse.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index b0249e56a..6ccc701db 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -73,6 +73,8 @@ Detailed list of changes - GNOME Wayland: Fix remembered window size smaller than actual size (:iss:`6946`) +- Mouse reporting: Fix incorrect position reported for windows with padding (:iss:`6950`) + 0.31.0 [2023-11-08] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/mouse.c b/kitty/mouse.c index 1a3ff06b7..b298a45e8 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -236,7 +236,7 @@ cell_for_pos(Window *w, unsigned int *x, unsigned int *y, bool *in_left_half_of_ bool in_left_half = true; double mouse_x = global_state.callback_os_window->mouse_x; double mouse_y = global_state.callback_os_window->mouse_y; - double left = window_left(w), top = window_top(w), right = window_right(w), bottom = window_bottom(w); + double left = g->left, top = g->top, right = g->right, bottom = g->bottom; w->mouse_pos.global_x = mouse_x - left; w->mouse_pos.global_y = mouse_y - top; if (clamp_to_window) { mouse_x = MIN(MAX(mouse_x, left), right);