[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:
Arjun Balgovind
2020-07-10 17:53:41 -07:00
committed by GitHub
parent bb2049411b
commit 7db5d6a307
7 changed files with 164 additions and 14 deletions

View File

@@ -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"";
}

View File

@@ -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;
}

View File

@@ -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();
};