mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 03:40:45 +08:00
[windows] Prevent WebView2 from processing keystrokes
This commit is contained in:
parent
b86d2fe8cd
commit
5d2cc81123
@ -55,14 +55,14 @@ class wv2ComHandler
|
|||||||
|
|
||||||
// This is our keyboard callback method
|
// This is our keyboard callback method
|
||||||
HRESULT STDMETHODCALLTYPE Invoke(ICoreWebView2Controller *controller, ICoreWebView2AcceleratorKeyPressedEventArgs * args) {
|
HRESULT STDMETHODCALLTYPE Invoke(ICoreWebView2Controller *controller, ICoreWebView2AcceleratorKeyPressedEventArgs * args) {
|
||||||
|
// Prevent WebView2 from processing the key
|
||||||
|
args->put_Handled(TRUE);
|
||||||
|
|
||||||
COREWEBVIEW2_KEY_EVENT_KIND kind;
|
COREWEBVIEW2_KEY_EVENT_KIND kind;
|
||||||
args->get_KeyEventKind(&kind);
|
args->get_KeyEventKind(&kind);
|
||||||
if (kind == COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN ||
|
if (kind == COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN ||
|
||||||
kind == COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_DOWN)
|
kind == COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_DOWN)
|
||||||
{
|
{
|
||||||
// Prevent WebView2 from processing the key
|
|
||||||
args->put_Handled(TRUE);
|
|
||||||
|
|
||||||
UINT key;
|
UINT key;
|
||||||
args->get_VirtualKey(&key);
|
args->get_VirtualKey(&key);
|
||||||
COREWEBVIEW2_PHYSICAL_KEY_STATUS status;
|
COREWEBVIEW2_PHYSICAL_KEY_STATUS status;
|
||||||
|
Loading…
Reference in New Issue
Block a user