From aaf2a4b6149db5048598f998bd9416f48358899f Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 13 Jan 2025 16:35:40 +1000 Subject: [PATCH] InputManager: Adjust scope of constants --- src/util/input_manager.cpp | 10 +++++----- src/util/input_manager.h | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/util/input_manager.cpp b/src/util/input_manager.cpp index 391caf391..d79e4969d 100644 --- a/src/util/input_manager.cpp +++ b/src/util/input_manager.cpp @@ -33,7 +33,7 @@ LOG_CHANNEL(InputManager); -namespace { +namespace InputManager { // ------------------------------------------------------------------------ // Constants @@ -41,8 +41,6 @@ namespace { enum : u32 { - MAX_KEYS_PER_BINDING = 4, - MAX_MOTORS_PER_PAD = 2, FIRST_EXTERNAL_INPUT_SOURCE = static_cast(InputSourceType::Pointer) + 1u, LAST_EXTERNAL_INPUT_SOURCE = static_cast(InputSourceType::Count), }; @@ -55,6 +53,8 @@ enum : u32 // all keys go active, and for axis callbacks, when all are active and // the value changes. +namespace { + struct InputBinding { InputBindingKey keys[MAX_KEYS_PER_BINDING] = {}; @@ -103,7 +103,6 @@ struct MacroButton // ------------------------------------------------------------------------ // Forward Declarations (for static qualifier) // ------------------------------------------------------------------------ -namespace InputManager { static std::optional ParseHostKeyboardKey(std::string_view source, std::string_view sub_binding); static std::optional ParsePointerKey(std::string_view source, std::string_view sub_binding); static std::optional ParseSensorKey(std::string_view source, std::string_view sub_binding); @@ -135,7 +134,6 @@ static void UpdateMacroButtons(); static void UpdateInputSourceState(const SettingsInterface& si, std::unique_lock& settings_lock, InputSourceType type, std::unique_ptr (*factory_function)()); -} // namespace InputManager // ------------------------------------------------------------------------ // Local Variables @@ -198,6 +196,8 @@ static bool s_relative_mouse_mode_active = false; static bool s_hide_host_mouse_cursor = false; static bool s_hide_host_mouse_cusor_active = false; +} // namespace InputManager + // ------------------------------------------------------------------------ // Binding Parsing // ------------------------------------------------------------------------ diff --git a/src/util/input_manager.h b/src/util/input_manager.h index 9a2bfddc0..f5ade5a10 100644 --- a/src/util/input_manager.h +++ b/src/util/input_manager.h @@ -189,6 +189,13 @@ public: }; namespace InputManager { + +/// Maximum number of buttons that can be part of a chord. +static constexpr u32 MAX_KEYS_PER_BINDING = 4; + +/// Maximum number of output vibration motors per pad. +static constexpr u32 MAX_MOTORS_PER_PAD = 2; + /// Minimum interval between vibration updates when the effect is continuous. static constexpr double VIBRATION_UPDATE_INTERVAL_SECONDS = 0.5; // 500ms