Compare commits

...

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
e78b7cc76c Remove Win+L shortcut restriction from Keyboard Manager
Co-authored-by: niels9001 <9866362+niels9001@users.noreply.github.com>
2026-01-31 08:01:03 +00:00
copilot-swe-agent[bot]
cb6e628b28 Initial plan 2026-01-31 07:58:24 +00:00
5 changed files with 2 additions and 77 deletions

View File

@@ -134,15 +134,9 @@ namespace EditorHelpers
return keys;
}
// Function to check if the shortcut is illegal (i.e. Win+L or Ctrl+Alt+Del)
// Function to check if the shortcut is illegal (i.e. Ctrl+Alt+Del)
ShortcutErrorType IsShortcutIllegal(Shortcut shortcut)
{
// Win+L
if (shortcut.winKey != ModifierKey::Disabled && shortcut.ctrlKey == ModifierKey::Disabled && shortcut.altKey == ModifierKey::Disabled && shortcut.shiftKey == ModifierKey::Disabled && shortcut.actionKey == 0x4C)
{
return ShortcutErrorType::WinL;
}
// Ctrl+Alt+Del
if (shortcut.winKey == ModifierKey::Disabled && shortcut.ctrlKey != ModifierKey::Disabled && shortcut.altKey != ModifierKey::Disabled && shortcut.shiftKey == ModifierKey::Disabled && shortcut.actionKey == VK_DELETE)
{

View File

@@ -20,6 +20,6 @@ namespace EditorHelpers
// Function to return a vector of hstring for each key in the display order
std::vector<winrt::hstring> GetKeyVector(Shortcut shortcut, LayoutMap& keyboardMap);
// Function to check if the shortcut is illegal (i.e. Win+L or Ctrl+Alt+Del)
// Function to check if the shortcut is illegal (i.e. Ctrl+Alt+Del)
ShortcutErrorType IsShortcutIllegal(Shortcut shortcut);
}

View File

@@ -20,8 +20,6 @@ winrt::hstring KeyboardManagerEditorStrings::GetErrorMessage(ShortcutErrorType e
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_MAPTOSAMESHORTCUT).c_str();
case ShortcutErrorType::ConflictingModifierShortcut:
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CONFLICTINGMODIFIERSHORTCUT).c_str();
case ShortcutErrorType::WinL:
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_WINL).c_str();
case ShortcutErrorType::CtrlAltDel:
return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CTRLALTDEL).c_str();
case ShortcutErrorType::RemapUnsuccessful:

View File

@@ -10,7 +10,6 @@ enum class ShortcutErrorType
SameShortcutPreviouslyMapped,
MapToSameShortcut,
ConflictingModifierShortcut,
WinL,
CtrlAltDel,
RemapUnsuccessful,
SaveFailed,

View File

@@ -874,72 +874,6 @@ namespace RemappingUITests
});
}
// Test if the ValidateShortcutBufferElement method returns WinL error on setting a drop down to Win or L on a column resulting in Win+L
TEST_METHOD (ValidateShortcutBufferElement_ShouldReturnWinLError_OnSettingDropDownToWinOrLOnColumnResultingInWinL)
{
std::vector<ValidateShortcutBufferElementArgs> testCases;
// Case 1: Validate the element when selecting L (0x4C) on second dropdown of first column of LWin+Empty shortcut
testCases.push_back({ 0, 0, 1, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ VK_LWIN }, Shortcut() }, std::wstring() } });
// Case 2: Validate the element when selecting L (0x4C) on second dropdown of second column of LWin+Empty shortcut
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN } }, std::wstring() } });
// Case 3: Validate the element when selecting L (0x4C) on second dropdown of second column of hybrid LWin+Empty shortcut
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN } }, std::wstring() } });
// Case 4: Validate the element when selecting L (0x4C) on second dropdown of first column of Win+Empty shortcut
testCases.push_back({ 0, 0, 1, std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH }, Shortcut() }, std::wstring() } });
// Case 5: Validate the element when selecting L (0x4C) on second dropdown of second column of Win+Empty shortcut
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH } }, std::wstring() } });
// Case 6: Validate the element when selecting L (0x4C) on second dropdown of second column of hybrid Win+Empty shortcut
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH } }, std::wstring() } });
// Case 7: Validate the element when selecting LWin (VK_LWIN) on first dropdown of first column of Empty+L shortcut
testCases.push_back({ 0, 0, 0, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ 0x4C }, Shortcut() }, std::wstring() } });
// Case 8: Validate the element when selecting LWin (VK_LWIN) on first dropdown of second column of Empty+L shortcut
testCases.push_back({ 0, 1, 0, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ 0x4C } }, std::wstring() } });
// Case 9: Validate the element when selecting LWin (VK_LWIN) on first dropdown of second column of hybrid Empty+L shortcut
testCases.push_back({ 0, 1, 0, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ 0x4C } }, std::wstring() } });
RunTestCases(testCases, [this](const ValidateShortcutBufferElementArgs& testCase) {
// Arrange
RemapBuffer remapBuffer;
remapBuffer.push_back(testCase.bufferRow);
// Act
std::pair<ShortcutErrorType, BufferValidationHelpers::DropDownAction> result = BufferValidationHelpers::ValidateShortcutBufferElement(testCase.elementRowIndex, testCase.elementColIndex, testCase.indexOfDropDownLastModified, testCase.selectedCodesOnDropDowns, testCase.targetAppNameInTextBox, testCase.isHybridColumn, remapBuffer, true);
// Assert that the element is invalid
Assert::AreEqual(true, result.first == ShortcutErrorType::WinL);
});
}
// Test if the ValidateShortcutBufferElement method returns WinL error on setting a drop down to null or none on a column resulting in Win+L
TEST_METHOD (ValidateShortcutBufferElement_ShouldReturnWinLError_OnSettingDropDownToNullOrNoneOnColumnResultingInWinL)
{
std::vector<ValidateShortcutBufferElementArgs> testCases;
// Case 1: Validate the element when selecting Null (-1) on second dropdown of first column of LWin + Ctrl + L shortcut
testCases.push_back({ 0, 0, 2, std::vector<int32_t>{ VK_LWIN, -1, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C }, Shortcut() }, std::wstring() } });
// Case 2: Validate the element when selecting Null (-1) on second dropdown of second column of LWin + Ctrl + L shortcut
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, -1, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
// Case 3: Validate the element when selecting Null (-1) on second dropdown of second column of hybrid LWin + Ctrl + L shortcut
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, -1, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
// Case 4: Validate the element when selecting None (0) on second dropdown of first column of LWin + Ctrl + L shortcut
testCases.push_back({ 0, 0, 2, std::vector<int32_t>{ VK_LWIN, 0, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C }, Shortcut() }, std::wstring() } });
// Case 5: Validate the element when selecting None (0) on second dropdown of second column of LWin + Ctrl + L shortcut
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, 0, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
// Case 6: Validate the element when selecting None (0) on second dropdown of second column of hybrid LWin + Ctrl + L shortcut
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, 0, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
RunTestCases(testCases, [this](const ValidateShortcutBufferElementArgs& testCase) {
// Arrange
RemapBuffer remapBuffer;
remapBuffer.push_back(testCase.bufferRow);
// Act
std::pair<ShortcutErrorType, BufferValidationHelpers::DropDownAction> result = BufferValidationHelpers::ValidateShortcutBufferElement(testCase.elementRowIndex, testCase.elementColIndex, testCase.indexOfDropDownLastModified, testCase.selectedCodesOnDropDowns, testCase.targetAppNameInTextBox, testCase.isHybridColumn, remapBuffer, true);
// Assert that the element is invalid
Assert::AreEqual(true, result.first == ShortcutErrorType::WinL);
});
}
// Test if the ValidateShortcutBufferElement method returns CtrlAltDel error on setting a drop down to Ctrl, Alt or Del on a column resulting in Ctrl+Alt+Del
TEST_METHOD (ValidateShortcutBufferElement_ShouldReturnCtrlAltDelError_OnSettingDropDownToCtrlAltOrDelOnColumnResultingInCtrlAltDel)
{