From b6a07c43a5c847cfa18c77969ae2150c24800bc8 Mon Sep 17 00:00:00 2001 From: Aleksander Date: Wed, 7 Aug 2024 18:07:25 +0200 Subject: [PATCH] Fix scrolling for all Electron-based applications --- src/backend/input.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backend/input.rs b/src/backend/input.rs index 1b39511..ce87528 100644 --- a/src/backend/input.rs +++ b/src/backend/input.rs @@ -366,10 +366,18 @@ where ); } - let haptics = hovered.backend.on_hover(app, &hit); + let scroll_threshold = 0.1; + let mut haptics: Option = None; + + // Pass mouse motion events only if not scrolling + // (allows scrolling on all Chromium-based applications) + if app.input_state.pointers[idx].now.scroll.abs() <= scroll_threshold { + haptics = hovered.backend.on_hover(app, &hit); + } + pointer = &mut app.input_state.pointers[idx]; - if pointer.now.scroll.abs() > 0.1 { + if pointer.now.scroll.abs() > scroll_threshold { let scroll = pointer.now.scroll; if app.input_state.pointers[1 - idx] .interaction