Skip to content

Commit 097c501

Browse files
authored
fix: handle non-client area pointer events from pen on Win10 (electron#24102)
1 parent d4bc4e1 commit 097c501

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

patches/chromium/.patches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
9999
disable_unnecessary_ischromefirstrun_check.patch
100100
disable_dcheck_that_fails_with_software_compositing.patch
101101
fix_default_to_ntlm_v2_in_network_service.patch
102+
fix_handling_non_client_pointer_events_from_pen_on_windows_10.patch
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Cheng Zhao <zcbenz@gmail.com>
3+
Date: Thu, 4 Oct 2018 14:57:02 -0700
4+
Subject: fix: handle non client pointer events from pen on Windows 10
5+
6+
Refs: https://github.com/electron/electron/issues/21440
7+
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2237535
8+
9+
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
10+
index faa47e9ef7f388dc0bfa5cd3efb961e6339ce390..274b9c247b8f970a6cf2be7b149d1885163551d9 100644
11+
--- a/ui/views/win/hwnd_message_handler.cc
12+
+++ b/ui/views/win/hwnd_message_handler.cc
13+
@@ -1988,6 +1988,15 @@ LRESULT HWNDMessageHandler::OnPointerEvent(UINT message,
14+
return -1;
15+
}
16+
17+
+ // Pen may also send non client pointer messages, treat them as normal
18+
+ // touch events so they can be properly handled.
19+
+ if (pointer_type == PT_PEN &&
20+
+ (message == WM_NCPOINTERDOWN ||
21+
+ message == WM_NCPOINTERUP ||
22+
+ message == WM_NCPOINTERUPDATE)) {
23+
+ pointer_type = PT_TOUCH;
24+
+ }
25+
+
26+
switch (pointer_type) {
27+
case PT_PEN:
28+
return HandlePointerEventTypePen(message, w_param, l_param);

0 commit comments

Comments
 (0)