From 413b17482b20bc7d26efdf69f74d4b84a029d407 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 24 Aug 2024 14:15:27 +1000 Subject: [PATCH] InputManager: Fix wheel scrolling in Big Picture --- src/util/imgui_manager.cpp | 2 +- src/util/input_manager.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/imgui_manager.cpp b/src/util/imgui_manager.cpp index 75e2cab5f..1cca1a50d 100644 --- a/src/util/imgui_manager.cpp +++ b/src/util/imgui_manager.cpp @@ -926,7 +926,7 @@ bool ImGuiManager::ProcessPointerButtonEvent(InputBindingKey key, float value) bool ImGuiManager::ProcessPointerAxisEvent(InputBindingKey key, float value) { - if (!ImGui::GetCurrentContext() || value == 0.0f || key.data < static_cast(InputPointerAxis::WheelX)) + if (!ImGui::GetCurrentContext() || key.data < static_cast(InputPointerAxis::WheelX)) return false; // still update state anyway diff --git a/src/util/input_manager.cpp b/src/util/input_manager.cpp index 8d7cf1fc4..da321e2d3 100644 --- a/src/util/input_manager.cpp +++ b/src/util/input_manager.cpp @@ -1187,6 +1187,9 @@ void InputManager::GenerateRelativeMouseEvents() { PointerAxisState& state = s_pointer_state[device][axis]; const float delta = static_cast(state.delta.exchange(0, std::memory_order_acquire)) / 65536.0f; + if (delta == 0.0f) + continue; + const float unclamped_value = delta * s_pointer_axis_scale[axis]; const InputBindingKey key(MakePointerAxisKey(device, static_cast(axis))); @@ -1276,7 +1279,7 @@ void InputManager::UpdatePointerAbsolutePosition(u32 index, float x, float y) void InputManager::UpdatePointerRelativeDelta(u32 index, InputPointerAxis axis, float d, bool raw_input) { - if (index >= MAX_POINTER_DEVICES || !s_relative_mouse_mode_active) + if (index >= MAX_POINTER_DEVICES || (axis < InputPointerAxis::WheelX && !s_relative_mouse_mode_active)) return; s_host_pointer_positions[index][static_cast(axis)] += d;