Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 1867953002: This will disable the behavior on Windows 10 in which (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates based on CL comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 531b4881a52f56d1dfe62604a6999364b81b6fd9..38821fda662b5762a0d96bc719c2b3d0744a12c4 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1564,6 +1564,31 @@ LRESULT HWNDMessageHandler::OnMouseRange(UINT message,
return HandleMouseEventInternal(message, w_param, l_param, true);
}
+// On some systems with a high-resolution track pad and running Windows 10,
+// using the scrolling gesture (two-finger scroll) on the track pad
+// causes it to also generate a WM_POINTERDOWN message if the window
+// isn't focused. This leads to a WM_POINTERACTIVATE message and the window
+// gaining focus and coming to the front. This code detects a
+// WM_POINTERACTIVATE coming from the track pad and kills the activation
+// of the window. NOTE: most other trackpad messages come in as mouse
+// messages, including WM_MOUSEWHEEL instead of WM_POINTERWHEEL.
+LRESULT HWNDMessageHandler::OnPointerActivate(UINT message,
+ WPARAM w_param,
+ LPARAM l_param) {
+ typedef BOOL(WINAPI *GetPointerTypeFn)(UINT32, POINTER_INPUT_TYPE *);
sky 2016/04/12 13:19:16 using?
kylix_rd 2016/04/12 14:32:27 Had to look that up... not quite fully up-to-speed
+ UINT32 pointerId = GET_POINTERID_WPARAM(w_param);
sky 2016/04/12 13:19:16 pointer_id
kylix_rd 2016/04/12 14:32:28 Done.
+ POINTER_INPUT_TYPE pointerType;
sky 2016/04/12 13:19:16 pointer_type
kylix_rd 2016/04/12 14:32:28 Done.
+ static GetPointerTypeFn get_pointer_type = reinterpret_cast<GetPointerTypeFn>(
+ GetProcAddress(GetModuleHandleA("user32.dll"), "GetPointerType"));
sky 2016/04/12 13:19:16 make sure you run git cl format (I think this shou
kylix_rd 2016/04/12 14:32:28 Done.
+ if (get_pointer_type && get_pointer_type(pointerId, &pointerType)) {
+ if (pointerType == PT_TOUCHPAD) {
sky 2016/04/12 13:19:16 Combine these into a single if statement.
kylix_rd 2016/04/12 14:32:27 Done.
+ return PA_NOACTIVATE;
+ }
+ }
+ SetMsgHandled(FALSE);
+ return -1;
+}
+
void HWNDMessageHandler::OnMove(const gfx::Point& point) {
delegate_->HandleMove();
SetMsgHandled(FALSE);
« no previous file with comments | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698