InputCommon: Fix occasional misidentification of analog input detection.

This commit is contained in:
Jordan Woyak
2025-05-23 01:55:32 -05:00
parent 2047eaf1d8
commit 11c3f7ea8d
3 changed files with 4 additions and 7 deletions

View File

@ -26,11 +26,6 @@ constexpr auto INPUT_DETECT_MAXIMUM_TIME = std::chrono::seconds(5);
// Ignore the mouse-click when queuing more buttons with "alternate mappings" enabled.
constexpr auto INPUT_DETECT_ENDING_IGNORE_TIME = std::chrono::milliseconds(50);
bool ContainsAnalogInput(const ciface::Core::InputDetector::Results& results)
{
return std::ranges::any_of(results, [](auto& detection) { return detection.smoothness > 1; });
}
class MappingProcessor : public QObject
{
public:
@ -102,7 +97,7 @@ public:
// Skip "Modifier" mappings when using analog inputs.
auto* next_button = m_clicked_mapping_buttons.front();
if (next_button->GetControlType() == MappingButton::ControlType::ModifierInput &&
ContainsAnalogInput(results))
std::ranges::any_of(results, &ciface::Core::InputDetector::Detection::IsAnalogPress))
{
// Clear "Modifier" mapping and queue the next button.
SetButtonExpression(next_button, "");