Windows: cefclient: Map Shift+Ctrl+Alt to Shift+AltGr for OSR (see issue #3026)

This commit is contained in:
campersau 2021-07-19 15:55:43 +00:00 committed by Marshall Greenblatt
parent 2be59f6edd
commit 1ffa5528b3
1 changed files with 3 additions and 1 deletions

View File

@ -801,10 +801,12 @@ void OsrWindowWin::OnKeyEvent(UINT message, WPARAM wParam, LPARAM lParam) {
// https://docs.microsoft.com/en-gb/windows/win32/api/winuser/nf-winuser-vkkeyscanexw
// ... high-order byte contains the shift state,
// which can be a combination of the following flag bits.
// 1 Either SHIFT key is pressed.
// 2 Either CTRL key is pressed.
// 4 Either ALT key is pressed.
SHORT scan_res = ::VkKeyScanExW(wParam, current_layout);
if (((scan_res >> 8) & 0xFF) == (2 | 4)) { // ctrl-alt pressed
constexpr auto ctrlAlt = (2 | 4);
if (((scan_res >> 8) & ctrlAlt) == ctrlAlt) { // ctrl-alt pressed
event.modifiers &= ~(EVENTFLAG_CONTROL_DOWN | EVENTFLAG_ALT_DOWN);
event.modifiers |= EVENTFLAG_ALTGR_DOWN;
}