Chromium Code Reviews| 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..7b8a77097df8baa89c072bfcfff4ece50474a93f 100644 |
| --- a/ui/views/win/hwnd_message_handler.cc |
| +++ b/ui/views/win/hwnd_message_handler.cc |
| @@ -1564,6 +1564,33 @@ LRESULT HWNDMessageHandler::OnMouseRange(UINT message, |
| return HandleMouseEventInternal(message, w_param, l_param, true); |
| } |
| +typedef BOOL (WINAPI *GetPointerTypeFn)(UINT32, POINTER_INPUT_TYPE *); |
|
ananta
2016/04/11 21:51:08
Please move this to the function. Perhaps use usin
kylix_rd
2016/04/11 22:41:07
Done.
|
| + |
| +// 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) { |
| + UINT32 pointerId = GET_POINTERID_WPARAM(w_param); |
| + POINTER_INPUT_TYPE pointerType; |
| + static GetPointerTypeFn get_pointer_type = reinterpret_cast<GetPointerTypeFn>( |
| + GetProcAddress(GetModuleHandleA("user32.dll"), "GetPointerType")); |
| + if (get_pointer_type && get_pointer_type(pointerId, &pointerType)) { |
| + if (pointerType == PT_TOUCHPAD) { |
| + SetMsgHandled(TRUE); |
|
ananta
2016/04/11 21:51:08
You don't need to call SetMsgHandled(TRUE). That s
kylix_rd
2016/04/11 22:41:07
Done.
|
| + return PA_NOACTIVATE; |
| + } |
| + } |
| + SetMsgHandled(FALSE); |
| + return -1; |
| +} |
| + |
| void HWNDMessageHandler::OnMove(const gfx::Point& point) { |
| delegate_->HandleMove(); |
| SetMsgHandled(FALSE); |