Merge branch 'fix-mouse-scroll' of https://github.com/page-down/kitty

This commit is contained in:
Kovid Goyal 2022-01-04 18:01:30 +05:30
commit 26b976d17d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -795,6 +795,17 @@ 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.
// Allows scroll events to be delivered to the child with correct pointer co-ordinates even when
// the window is not focused on 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 };