mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Keyboard Manager] Fixed app-specific shortcut causing app to lose focus scenario (#4902)
* Fixed focus issue and added tests * Changed key names * Use constant instead of hardcoded empty string
This commit is contained in:
@@ -96,4 +96,7 @@ namespace KeyboardManagerConstants
|
||||
|
||||
// String constant for the default app name in Remap shortcuts
|
||||
inline const std::wstring DefaultAppName = L"All Apps";
|
||||
|
||||
// String constant to represent no activated application in app-specific shortcuts
|
||||
inline const std::wstring NoActivatedApp = L"";
|
||||
}
|
||||
@@ -528,4 +528,16 @@ std::wstring KeyboardManagerState::GetCurrentConfigName()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(currentConfig_mutex);
|
||||
return currentConfig;
|
||||
}
|
||||
}
|
||||
|
||||
// Sets the activated target application in app-specfic shortcut
|
||||
void KeyboardManagerState::SetActivatedApp(const std::wstring& appName)
|
||||
{
|
||||
activatedAppSpecificShortcutTarget = appName;
|
||||
}
|
||||
|
||||
// Gets the activated target application in app-specfic shortcut
|
||||
std::wstring KeyboardManagerState::GetActivatedApp()
|
||||
{
|
||||
return activatedAppSpecificShortcutTarget;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ private:
|
||||
std::map<DWORD, std::unique_ptr<KeyDelay>> keyDelays;
|
||||
std::mutex keyDelays_mutex;
|
||||
|
||||
// Stores the activated target application in app-specfic shortcut
|
||||
std::wstring activatedAppSpecificShortcutTarget;
|
||||
|
||||
// Display a key by appending a border Control as a child of the panel.
|
||||
void AddKeyToLayout(const StackPanel& panel, const winrt::hstring& key);
|
||||
|
||||
@@ -190,4 +193,10 @@ public:
|
||||
|
||||
// Gets the Current Active Configuration Name.
|
||||
std::wstring GetCurrentConfigName();
|
||||
|
||||
// Sets the activated target application in app-specfic shortcut
|
||||
void SetActivatedApp(const std::wstring& appName);
|
||||
|
||||
// Gets the activated target application in app-specfic shortcut
|
||||
std::wstring GetActivatedApp();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user