Skip to content

Commit 9b095a9

Browse files
committed
New approach: If Alt is mapped to anything, don't have it open the menu.
1 parent 2ddba06 commit 9b095a9

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

Windows/MainWindow.cpp

+15-16
Original file line numberDiff line numberDiff line change
@@ -1092,29 +1092,28 @@ namespace MainWindow
10921092
// Note that if there's a screensaver password, this simple method
10931093
// doesn't work on Vista or higher.
10941094
case WM_SYSCOMMAND:
1095-
{
1096-
// Disable Alt key for menu if "Ignore Windows Key" is on (likely related)
1097-
if (g_Config.bIgnoreWindowsKey && wParam == SC_KEYMENU && (lParam >> 16) <= 0) {
1095+
// Disable Alt key for menu if it's been mapped.
1096+
if (wParam == SC_KEYMENU && (lParam >> 16) <= 0) {
1097+
if (KeyMap::IsKeyMapped(DEVICE_ID_KEYBOARD, NKCODE_ALT_LEFT) || KeyMap::IsKeyMapped(DEVICE_ID_KEYBOARD, NKCODE_ALT_RIGHT)) {
10981098
return 0;
10991099
}
1100-
if (g_keepScreenBright) {
1101-
switch (wParam) {
1102-
case SC_SCREENSAVE:
1100+
}
1101+
if (g_keepScreenBright) {
1102+
switch (wParam) {
1103+
case SC_SCREENSAVE:
1104+
return 0;
1105+
case SC_MONITORPOWER:
1106+
if (lParam == 1 || lParam == 2) {
11031107
return 0;
1104-
case SC_MONITORPOWER:
1105-
if (lParam == 1 || lParam == 2) {
1106-
return 0;
1107-
} else {
1108-
break;
1109-
}
1110-
default:
1111-
// fall down to DefWindowProc
1108+
} else {
11121109
break;
11131110
}
1111+
default:
1112+
// fall down to DefWindowProc
1113+
break;
11141114
}
1115-
return DefWindowProc(hWnd, message, wParam, lParam);
11161115
}
1117-
break;
1116+
return DefWindowProc(hWnd, message, wParam, lParam);
11181117
case WM_SETTINGCHANGE:
11191118
{
11201119
if (g_darkModeSupported && IsColorSchemeChangeMessage(lParam))

0 commit comments

Comments
 (0)