Browse Source

fix: handle non-client area pointer events from pen on Win10 (#24103)

* fix: handle non client pointer events from pen on Win10

* fix trop oops

* update patches

Co-authored-by: Cheng Zhao <[email protected]>
Co-authored-by: Charles Kerr <[email protected]>
trop[bot] 4 years ago
parent
commit
e8e05f7e99

+ 1 - 0
patches/chromium/.patches

@@ -103,3 +103,4 @@ fix_swap_global_proxies_before_initializing_the_windows_proxies.patch
 fix_default_to_ntlm_v2_in_network_service.patch
 a11y_iterate_all_descendants_for_getselectioncount.patch
 a11y_allows_klistboxoption_as_an_item_to_kgroup.patch
+fix_handling_non_client_pointer_events_from_pen_on_windows_10.patch

+ 28 - 0
patches/chromium/fix_handling_non_client_pointer_events_from_pen_on_windows_10.patch

@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Cheng Zhao <[email protected]>
+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 281c722d81c0ad5fa7bacbe25c07a7578dfa43b6..037ace982ed86c515e7b024d0cd2862d604ec63b 100644
+--- a/ui/views/win/hwnd_message_handler.cc
++++ b/ui/views/win/hwnd_message_handler.cc
+@@ -1993,6 +1993,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);