fix: handle non client pointer events from pen on Win10 (#24042)

This commit is contained in:
Cheng Zhao 2020-06-12 23:26:16 +09:00 committed by GitHub
parent 7274467f73
commit d5f642938d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View file

@ -100,3 +100,4 @@ disable_dcheck_that_fails_with_software_compositing.patch
fix_swap_global_proxies_before_initializing_the_windows_proxies.patch
fix_default_to_ntlm_v2_in_network_service.patch
feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
fix_handling_non_client_pointer_events_from_pen_on_windows_10.patch

View file

@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Thu, 4 Oct 2018 14:57:02 -0700
Subject: fix: handle non client pointer events from pen on Windows 10
Refs: https://github.com/electron/electron/issues/21440
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2237535
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index faa47e9ef7f388dc0bfa5cd3efb961e6339ce390..274b9c247b8f970a6cf2be7b149d1885163551d9 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1988,6 +1988,15 @@ LRESULT HWNDMessageHandler::OnPointerEvent(UINT message,
return -1;
}
+ // Pen may also send non client pointer messages, treat them as normal
+ // touch events so they can be properly handled.
+ if (pointer_type == PT_PEN &&
+ (message == WM_NCPOINTERDOWN ||
+ message == WM_NCPOINTERUP ||
+ message == WM_NCPOINTERUPDATE)) {
+ pointer_type = PT_TOUCH;
+ }
+
switch (pointer_type) {
case PT_PEN:
return HandlePointerEventTypePen(message, w_param, l_param);