From 3141fc3f0571e373832263ff02f2dab626c982c0 Mon Sep 17 00:00:00 2001 From: pagedown Date: Tue, 4 Jan 2022 19:39:36 +0800 Subject: [PATCH] Update mouse cursor position when scrolling without OS window focus --- kitty/mouse.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kitty/mouse.c b/kitty/mouse.c index c38348dc8..d16bf3028 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -795,6 +795,16 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags, int modifiers) { if (t) w = t->windows + t->active_window; } if (!w) return; + // Also update mouse cursor position while kitty OS window is not focused. + // Allow scrolling of the mouse pointing part of a multi-panel program when not focused under macOS. + if (!osw->is_focused) { + unsigned int x = 0, y = 0; + bool in_left_half_of_cell; + if (cell_for_pos(w, &x, &y, &in_left_half_of_cell, osw)) { + w->mouse_pos.cell_x = x; w->mouse_pos.cell_y = y; + w->mouse_pos.in_left_half_of_cell = in_left_half_of_cell; + } + } Screen *screen = w->render_data.screen; enum MomentumData { NoMomentumData, MomentumPhaseBegan, MomentumPhaseStationary, MomentumPhaseActive, MomentumPhaseEnded, MomentumPhaseCancelled, MomentumPhaseMayBegin };