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
This commit is contained in:
ptrsky
2021-06-21 07:15:58 +02:00
committed by Alex Maitland
parent 16c141357f
commit aa8a02f5de
@@ -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;