From 43a25c49c4e42184970d750f7937c448a1d49a7d Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 27 Dec 2018 15:19:22 +0100 Subject: [PATCH] Micro optimization --- kitty/mouse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kitty/mouse.c b/kitty/mouse.c index 98bfefa11..60384d21b 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -569,9 +569,6 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) { } if (!w) return; - int s; - bool is_high_resolution = flags & 1; - Screen *screen = w->render_data.screen; enum MomentumData { NoMomentumData, MomentumPhaseBegan, MomentumPhaseStationary, MomentumPhaseActive, MomentumPhaseEnded, MomentumPhaseCancelled, MomentumPhaseMayBegin }; enum MomentumData momentum_data = (flags >> 1) & 7; @@ -587,6 +584,11 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) { break; } if (yoffset == 0.0) return; + + int s; + bool is_high_resolution = flags & 1; + Screen *screen = w->render_data.screen; + if (is_high_resolution) { yoffset *= OPT(touch_scroll_multiplier); if (yoffset * global_state.callback_os_window->pending_scroll_pixels < 0) {