Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/win/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #include <tchar.h> | 10 #include <tchar.h> |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1557 SetMsgHandled(FALSE); | 1557 SetMsgHandled(FALSE); |
| 1558 return MA_ACTIVATE; | 1558 return MA_ACTIVATE; |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 LRESULT HWNDMessageHandler::OnMouseRange(UINT message, | 1561 LRESULT HWNDMessageHandler::OnMouseRange(UINT message, |
| 1562 WPARAM w_param, | 1562 WPARAM w_param, |
| 1563 LPARAM l_param) { | 1563 LPARAM l_param) { |
| 1564 return HandleMouseEventInternal(message, w_param, l_param, true); | 1564 return HandleMouseEventInternal(message, w_param, l_param, true); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 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.
| |
| 1568 | |
| 1569 // On some systems with a high-resolution track pad and running Windows 10, | |
| 1570 // using the scrolling gesture (two-finger scroll) on the track pad | |
| 1571 // causes it to also generate a WM_POINTERDOWN message if the window | |
| 1572 // isn't focused. This leads to a WM_POINTERACTIVATE message and the window | |
| 1573 // gaining focus and coming to the front. This code detects a | |
| 1574 // WM_POINTERACTIVATE coming from the track pad and kills the activation | |
| 1575 // of the window. NOTE: most other trackpad messages come in as mouse | |
| 1576 // messages, including WM_MOUSEWHEEL instead of WM_POINTERWHEEL. | |
| 1577 LRESULT HWNDMessageHandler::OnPointerActivate(UINT message, | |
| 1578 WPARAM w_param, | |
| 1579 LPARAM l_param) { | |
| 1580 UINT32 pointerId = GET_POINTERID_WPARAM(w_param); | |
| 1581 POINTER_INPUT_TYPE pointerType; | |
| 1582 static GetPointerTypeFn get_pointer_type = reinterpret_cast<GetPointerTypeFn>( | |
| 1583 GetProcAddress(GetModuleHandleA("user32.dll"), "GetPointerType")); | |
| 1584 if (get_pointer_type && get_pointer_type(pointerId, &pointerType)) { | |
| 1585 if (pointerType == PT_TOUCHPAD) { | |
| 1586 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.
| |
| 1587 return PA_NOACTIVATE; | |
| 1588 } | |
| 1589 } | |
| 1590 SetMsgHandled(FALSE); | |
| 1591 return -1; | |
| 1592 } | |
| 1593 | |
| 1567 void HWNDMessageHandler::OnMove(const gfx::Point& point) { | 1594 void HWNDMessageHandler::OnMove(const gfx::Point& point) { |
| 1568 delegate_->HandleMove(); | 1595 delegate_->HandleMove(); |
| 1569 SetMsgHandled(FALSE); | 1596 SetMsgHandled(FALSE); |
| 1570 } | 1597 } |
| 1571 | 1598 |
| 1572 void HWNDMessageHandler::OnMoving(UINT param, const RECT* new_bounds) { | 1599 void HWNDMessageHandler::OnMoving(UINT param, const RECT* new_bounds) { |
| 1573 delegate_->HandleMove(); | 1600 delegate_->HandleMove(); |
| 1574 } | 1601 } |
| 1575 | 1602 |
| 1576 LRESULT HWNDMessageHandler::OnNCActivate(UINT message, | 1603 LRESULT HWNDMessageHandler::OnNCActivate(UINT message, |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2629 delegate_->HandleClientSizeChanged(GetClientAreaBounds().size()); | 2656 delegate_->HandleClientSizeChanged(GetClientAreaBounds().size()); |
| 2630 ResetWindowRegion(false, true); | 2657 ResetWindowRegion(false, true); |
| 2631 } | 2658 } |
| 2632 | 2659 |
| 2633 if (direct_manipulation_helper_) | 2660 if (direct_manipulation_helper_) |
| 2634 direct_manipulation_helper_->SetBounds(bounds_in_pixels); | 2661 direct_manipulation_helper_->SetBounds(bounds_in_pixels); |
| 2635 } | 2662 } |
| 2636 | 2663 |
| 2637 | 2664 |
| 2638 } // namespace views | 2665 } // namespace views |
| OLD | NEW |