diff --git a/CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.cpp b/CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.cpp index de69c6b57..2e90219c7 100644 --- a/CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.cpp +++ b/CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.cpp @@ -388,10 +388,13 @@ void CefBrowserHostWrapper::SendKeyEvent(int message, int wParam, int 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); + constexpr auto shiftCtrlAlt = (1 | 2 | 4); + if (((scan_res >> 8) & 0xFF) == ctrlAlt || ((scan_res >> 8) & 0xFF) == shiftCtrlAlt) { keyEvent.modifiers &= ~(EVENTFLAG_CONTROL_DOWN | EVENTFLAG_ALT_DOWN); keyEvent.modifiers |= EVENTFLAG_ALTGR_DOWN;