From 5d2cc81123a1bb74d29cb6665a997df67fb06a6a Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 18 Jul 2021 19:02:33 +1000 Subject: [PATCH] [windows] Prevent WebView2 from processing keystrokes --- v2/internal/ffenestri/wv2ComHandler_windows.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v2/internal/ffenestri/wv2ComHandler_windows.h b/v2/internal/ffenestri/wv2ComHandler_windows.h index 48b4e043..60fc4357 100644 --- a/v2/internal/ffenestri/wv2ComHandler_windows.h +++ b/v2/internal/ffenestri/wv2ComHandler_windows.h @@ -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;