mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-26 08:06:33 +00:00
Re-purposed debounceThreshold
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user