5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 03:21:32 +08:00

[windows] Prevent WebView2 from processing keystrokes

This commit is contained in:
Lea Anthony 2021-07-18 19:02:33 +10:00
parent b86d2fe8cd
commit 5d2cc81123

View File

@ -55,14 +55,14 @@ class wv2ComHandler
// This is our keyboard callback method
HRESULT STDMETHODCALLTYPE Invoke(ICoreWebView2Controller *controller, ICoreWebView2AcceleratorKeyPressedEventArgs * args) {
// Prevent WebView2 from processing the key
args->put_Handled(TRUE);
COREWEBVIEW2_KEY_EVENT_KIND kind;
args->get_KeyEventKind(&kind);
if (kind == COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN ||
kind == COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_DOWN)
{
// Prevent WebView2 from processing the key
args->put_Handled(TRUE);
UINT key;
args->get_VirtualKey(&key);
COREWEBVIEW2_PHYSICAL_KEY_STATUS status;