From aa8a02f5dedc31a21db0abd0148c8cb8ccc36019 Mon Sep 17 00:00:00 2001 From: ptrsky Date: Mon, 21 Jun 2021 07:15:58 +0200 Subject: [PATCH] WPF - Add support for Shift+AltGr (#3627) * WPF - Add support for Shift+AltGr The handling of AltGr characters in CefBrowsterHostWrapper did not cover capital diacritic letters. This commit adds handling for the Shift + AltGr + character combination. * WPF - Shift+AltGr review fixes * Trigger rebuild --- CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;