mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 02:06:36 +02:00
Unregister key delays on closing KBM windows (#6583)
This commit is contained in:
@@ -240,7 +240,6 @@ void KeyboardManagerState::UpdateDetectShortcutUI()
|
||||
auto detectedShortcutCopy = detectedShortcut;
|
||||
currentShortcut_lock.unlock();
|
||||
detectedShortcut_lock.unlock();
|
||||
|
||||
// Since this function is invoked from the back-end thread, in order to update the UI the dispatcher must be used.
|
||||
currentShortcutUI1.as<StackPanel>().Dispatcher().RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, [this, detectedShortcutCopy]() {
|
||||
std::vector<hstring> shortcut = detectedShortcutCopy.GetKeyVector(keyboardMap);
|
||||
@@ -419,6 +418,7 @@ void KeyboardManagerState::RegisterKeyDelay(
|
||||
{
|
||||
throw std::invalid_argument("This key was already registered.");
|
||||
}
|
||||
|
||||
keyDelays[key] = std::make_unique<KeyDelay>(key, onShortPress, onLongPressDetected, onLongPressReleased);
|
||||
}
|
||||
|
||||
@@ -433,6 +433,13 @@ void KeyboardManagerState::UnregisterKeyDelay(DWORD key)
|
||||
}
|
||||
}
|
||||
|
||||
// Function to clear all the registered key delays
|
||||
void KeyboardManagerState::ClearRegisteredKeyDelays()
|
||||
{
|
||||
std::lock_guard l(keyDelays_mutex);
|
||||
keyDelays.clear();
|
||||
}
|
||||
|
||||
bool KeyboardManagerState::HandleKeyDelayEvent(LowlevelKeyboardEvent* ev)
|
||||
{
|
||||
if (currentUIWindow != GetForegroundWindow())
|
||||
|
||||
Reference in New Issue
Block a user