Re-purposed debounceThreshold

This commit is contained in:
cdozdil
2026-06-15 00:18:23 +03:00
parent d353378875
commit d3adf193ca
2 changed files with 11 additions and 4 deletions
+2 -2
View File
@@ -117,7 +117,7 @@ void LogHwndIdentityLocked(const char* label, HWND hwnd)
{
if (hwnd == nullptr)
{
LOG_DEBUG("{}: hwnd=null", label);
LOG_DEBUG("{}: hwnd:null", label);
return;
}
@@ -709,7 +709,7 @@ void ApplyMenuVisibilityChangeLocked(bool visible)
_state.HasBlockedCursorScreenPos = true;
LOG_DEBUG("captured blocked cursor position screen=({}, {})", _state.BlockedCursorScreenPos.x,
LOG_DEBUG("captured blocked cursor position screen:({}, {})", _state.BlockedCursorScreenPos.x,
_state.BlockedCursorScreenPos.y);
BeginCursorClipBlockLocked();
+9 -2
View File
@@ -44,7 +44,7 @@ static bool inputFG = false;
static bool inputFps = false;
static bool inputFpsCycle = false;
static uint64_t lastInputTick = 0;
constexpr uint64_t debounceThreshold = 60;
constexpr uint64_t debounceThreshold = 1000;
static bool hasGamepad = false;
static bool fsr31InitTried = false;
@@ -254,7 +254,10 @@ void MenuCommon::UpdateManualInput(HWND targetHwnd)
}
};
if (!capturingKey)
const auto currentTick = GetTickCount64();
const bool canAcceptInputs = lastInputTick + debounceThreshold < currentTick;
if (!capturingKey && canAcceptInputs)
{
CheckShortcut(config->ShortcutKey.value_or_default(), inputMenu, "Menu key pressed, will be switching menu");
CheckShortcut(config->FpsShortcutKey.value_or_default(), inputFps, "Menu key pressed, will be switching FPS");
@@ -262,6 +265,10 @@ void MenuCommon::UpdateManualInput(HWND targetHwnd)
CheckShortcut(config->FpsCycleShortcutKey.value_or_default(), inputFpsCycle,
"Menu key pressed, will be switching FPS mode");
}
else if (capturingKey)
{
lastInputTick = currentTick;
}
lastKey = OptiInput::GetLastPressedKey();