Skip to content

Commit

Permalink
WPF - Add support for Shift+AltGr (#3627)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ptrsky authored Jun 21, 2021
1 parent 42ffee0 commit 136b928
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 136b928

Please sign in to comment.