Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow "Alt" to act like a normal keyboard input, if it's been mapped to something #19304

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions Windows/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,25 +1092,28 @@ namespace MainWindow
// Note that if there's a screensaver password, this simple method
// doesn't work on Vista or higher.
case WM_SYSCOMMAND:
{
if (g_keepScreenBright) {
switch (wParam) {
case SC_SCREENSAVE:
// Disable Alt key for menu if it's been mapped.
if (wParam == SC_KEYMENU && (lParam >> 16) <= 0) {
if (KeyMap::IsKeyMapped(DEVICE_ID_KEYBOARD, NKCODE_ALT_LEFT) || KeyMap::IsKeyMapped(DEVICE_ID_KEYBOARD, NKCODE_ALT_RIGHT)) {
return 0;
}
}
if (g_keepScreenBright) {
switch (wParam) {
case SC_SCREENSAVE:
return 0;
case SC_MONITORPOWER:
if (lParam == 1 || lParam == 2) {
return 0;
case SC_MONITORPOWER:
if (lParam == 1 || lParam == 2) {
return 0;
} else {
break;
}
default:
// fall down to DefWindowProc
} else {
break;
}
default:
// fall down to DefWindowProc
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
return DefWindowProc(hWnd, message, wParam, lParam);
case WM_SETTINGCHANGE:
{
if (g_darkModeSupported && IsColorSchemeChangeMessage(lParam))
Expand Down
Loading