mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[Keyboard Manager] Add app-specific shortcuts to Remap shortcuts UI (#4804)
* Enable app specific shortcut remapping * Fixed lowercase function call * Add test file * Moved GetForegroundProcess to II and added tests * Fixed runtime error while testing due to heap allocation across dll boundary * Renamed function * Changed shortcutBuffer type * Linked App specific UI to backend * Added shortcut validation logic on TextBox LostFocus handler * Moved Validate function and changed default text * Changed to case insensitive warning check * Changed to case insensitive warning check at OnClickAccept * Fixed alignment and spacing issues
This commit is contained in:
@@ -47,7 +47,7 @@ namespace KeyboardManagerConstants
|
||||
// Default window sizes
|
||||
inline const int DefaultEditKeyboardWindowWidth = 800;
|
||||
inline const int DefaultEditKeyboardWindowHeight = 600;
|
||||
inline const int DefaultEditShortcutsWindowWidth = 1000;
|
||||
inline const int DefaultEditShortcutsWindowWidth = 1050;
|
||||
inline const int DefaultEditShortcutsWindowHeight = 600;
|
||||
|
||||
// Key Remap table constants
|
||||
@@ -60,12 +60,13 @@ namespace KeyboardManagerConstants
|
||||
inline const DWORD64 RemapTableDropDownWidth = 110;
|
||||
|
||||
// Shortcut table constants
|
||||
inline const long ShortcutTableColCount = 4;
|
||||
inline const long ShortcutTableHeaderCount = 2;
|
||||
inline const long ShortcutTableColCount = 5;
|
||||
inline const long ShortcutTableHeaderCount = 3;
|
||||
inline const long ShortcutTableOriginalColIndex = 0;
|
||||
inline const long ShortcutTableArrowColIndex = 1;
|
||||
inline const long ShortcutTableNewColIndex = 2;
|
||||
inline const long ShortcutTableRemoveColIndex = 3;
|
||||
inline const long ShortcutTableTargetAppColIndex = 3;
|
||||
inline const long ShortcutTableRemoveColIndex = 4;
|
||||
inline const DWORD64 ShortcutTableDropDownWidth = 110;
|
||||
inline const DWORD64 ShortcutTableDropDownSpacing = 10;
|
||||
|
||||
@@ -74,6 +75,7 @@ namespace KeyboardManagerConstants
|
||||
inline const DWORD64 TableArrowColWidth = 20;
|
||||
inline const DWORD64 TableRemoveColWidth = 20;
|
||||
inline const DWORD64 TableWarningColWidth = 20;
|
||||
inline const DWORD64 TableTargetAppColWidth = ShortcutTableDropDownWidth + 50;
|
||||
|
||||
// Shared style constants for both Remap Table and Shortcut Table
|
||||
inline const DWORD64 HeaderButtonWidth = 100;
|
||||
@@ -85,4 +87,7 @@ namespace KeyboardManagerConstants
|
||||
|
||||
// Dummy key event used in between key up and down events to prevent certain global events from happening
|
||||
inline const DWORD DUMMY_KEY = 0xFF;
|
||||
|
||||
// String constant for the default app name in Remap shortcuts
|
||||
inline const std::wstring DefaultAppName = L"All Apps";
|
||||
}
|
||||
@@ -50,3 +50,14 @@ void Trace::OSLevelShortcutRemapCount(const DWORD count) noexcept
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingValue(count, "OSLevelShortcutRemapCount"));
|
||||
}
|
||||
|
||||
// Log number of app specific shortcut remaps when the user uses Edit Shortcuts and saves settings
|
||||
void Trace::AppSpecificShortcutRemapCount(const DWORD count) noexcept
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"KeyboardManager_AppSpecificShortcutRemapCount",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingValue(count, "AppSpecificShortcutRemapCount"));
|
||||
}
|
||||
|
||||
@@ -14,4 +14,7 @@ public:
|
||||
|
||||
// Log number of os level shortcut remaps when the user uses Edit Shortcuts and saves settings
|
||||
static void OSLevelShortcutRemapCount(const DWORD count) noexcept;
|
||||
|
||||
// Log number of app specific shortcut remaps when the user uses Edit Shortcuts and saves settings
|
||||
static void AppSpecificShortcutRemapCount(const DWORD count) noexcept;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user