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 // On some systems with a high-resolution track pad and running Windows 10, | |
| 1568 // using the scrolling gesture (two-finger scroll) on the track pad | |
| 1569 // causes it to also generate a WM_POINTERDOWN message if the window | |
| 1570 // isn't focused. This leads to a WM_POINTERACTIVATE message and the window | |
| 1571 // gaining focus and coming to the front. This code detects a | |
| 1572 // WM_POINTERACTIVATE coming from the track pad and kills the activation | |
| 1573 // of the window. NOTE: most other trackpad messages come in as mouse | |
| 1574 // messages, including WM_MOUSEWHEEL instead of WM_POINTERWHEEL. | |
| 1575 LRESULT HWNDMessageHandler::OnPointerActivate(UINT message, | |
| 1576 WPARAM w_param, | |
| 1577 LPARAM l_param) { | |
| 1578 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
| |
| 1579 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.
| |
| 1580 POINTER_INPUT_TYPE pointerType; | |
|
sky
2016/04/12 13:19:16
pointer_type
kylix_rd
2016/04/12 14:32:28
Done.
| |
| 1581 static GetPointerTypeFn get_pointer_type = reinterpret_cast<GetPointerTypeFn>( | |
| 1582 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.
| |
| 1583 if (get_pointer_type && get_pointer_type(pointerId, &pointerType)) { | |
| 1584 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.
| |
| 1585 return PA_NOACTIVATE; | |
| 1586 } | |
| 1587 } | |
| 1588 SetMsgHandled(FALSE); | |
| 1589 return -1; | |
| 1590 } | |
| 1591 | |
| 1567 void HWNDMessageHandler::OnMove(const gfx::Point& point) { | 1592 void HWNDMessageHandler::OnMove(const gfx::Point& point) { |
| 1568 delegate_->HandleMove(); | 1593 delegate_->HandleMove(); |
| 1569 SetMsgHandled(FALSE); | 1594 SetMsgHandled(FALSE); |
| 1570 } | 1595 } |
| 1571 | 1596 |
| 1572 void HWNDMessageHandler::OnMoving(UINT param, const RECT* new_bounds) { | 1597 void HWNDMessageHandler::OnMoving(UINT param, const RECT* new_bounds) { |
| 1573 delegate_->HandleMove(); | 1598 delegate_->HandleMove(); |
| 1574 } | 1599 } |
| 1575 | 1600 |
| 1576 LRESULT HWNDMessageHandler::OnNCActivate(UINT message, | 1601 LRESULT HWNDMessageHandler::OnNCActivate(UINT message, |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2629 delegate_->HandleClientSizeChanged(GetClientAreaBounds().size()); | 2654 delegate_->HandleClientSizeChanged(GetClientAreaBounds().size()); |
| 2630 ResetWindowRegion(false, true); | 2655 ResetWindowRegion(false, true); |
| 2631 } | 2656 } |
| 2632 | 2657 |
| 2633 if (direct_manipulation_helper_) | 2658 if (direct_manipulation_helper_) |
| 2634 direct_manipulation_helper_->SetBounds(bounds_in_pixels); | 2659 direct_manipulation_helper_->SetBounds(bounds_in_pixels); |
| 2635 } | 2660 } |
| 2636 | 2661 |
| 2637 | 2662 |
| 2638 } // namespace views | 2663 } // namespace views |
| OLD | NEW |