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 <wtsapi32.h> | 10 #include <wtsapi32.h> |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 } | 1621 } |
1622 } | 1622 } |
1623 } else if (message == WM_NCRBUTTONDOWN && | 1623 } else if (message == WM_NCRBUTTONDOWN && |
1624 (w_param == HTCAPTION || w_param == HTSYSMENU)) { | 1624 (w_param == HTCAPTION || w_param == HTSYSMENU)) { |
1625 is_right_mouse_pressed_on_caption_ = true; | 1625 is_right_mouse_pressed_on_caption_ = true; |
1626 // We SetCapture() to ensure we only show the menu when the button | 1626 // We SetCapture() to ensure we only show the menu when the button |
1627 // down and up are both on the caption. Note: this causes the button up to | 1627 // down and up are both on the caption. Note: this causes the button up to |
1628 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP. | 1628 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP. |
1629 SetCapture(); | 1629 SetCapture(); |
1630 } | 1630 } |
1631 | |
1632 MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime(), | 1631 MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime(), |
1633 { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } }; | 1632 { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } }; |
1634 ui::MouseEvent event(msg); | 1633 ui::MouseEvent event(msg); |
1635 if (!touch_ids_.empty() || ui::IsMouseEventFromTouch(message)) | 1634 if (!touch_ids_.empty() || ui::IsMouseEventFromTouch(message)) |
1636 event.set_flags(event.flags() | ui::EF_FROM_TOUCH); | 1635 event.set_flags(event.flags() | ui::EF_FROM_TOUCH); |
1637 | 1636 |
1638 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) | 1637 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) |
1639 delegate_->HandleTooltipMouseMove(message, w_param, l_param); | 1638 delegate_->HandleTooltipMouseMove(message, w_param, l_param); |
1640 | 1639 |
1641 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture()) { | 1640 // Certain child windows forward mouse events to us. We don't want to track |
| 1641 // these mouse moves as the child window will also send us a WM_MOUSELEAVE. |
| 1642 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture() && |
| 1643 HIWORD(w_param) != SPECIAL_MOUSEMOVE_NOT_TO_BE_TRACKED) { |
1642 // Windows only fires WM_MOUSELEAVE events if the application begins | 1644 // Windows only fires WM_MOUSELEAVE events if the application begins |
1643 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. | 1645 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. |
1644 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. | 1646 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. |
1645 TrackMouseEvents((message == WM_NCMOUSEMOVE) ? | 1647 TrackMouseEvents((message == WM_NCMOUSEMOVE) ? |
1646 TME_NONCLIENT | TME_LEAVE : TME_LEAVE); | 1648 TME_NONCLIENT | TME_LEAVE : TME_LEAVE); |
1647 } else if (event.type() == ui::ET_MOUSE_EXITED) { | 1649 } else if (event.type() == ui::ET_MOUSE_EXITED) { |
1648 // Reset our tracking flags so future mouse movement over this | 1650 // Reset our tracking flags so future mouse movement over this |
1649 // NativeWidgetWin results in a new tracking session. Fall through for | 1651 // NativeWidgetWin results in a new tracking session. Fall through for |
1650 // OnMouseEvent. | 1652 // OnMouseEvent. |
1651 active_mouse_tracking_flags_ = 0; | 1653 active_mouse_tracking_flags_ = 0; |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 SetMsgHandled(FALSE); | 2391 SetMsgHandled(FALSE); |
2390 } | 2392 } |
2391 | 2393 |
2392 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { | 2394 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { |
2393 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); | 2395 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); |
2394 for (size_t i = 0; i < touch_events.size() && ref; ++i) | 2396 for (size_t i = 0; i < touch_events.size() && ref; ++i) |
2395 delegate_->HandleTouchEvent(touch_events[i]); | 2397 delegate_->HandleTouchEvent(touch_events[i]); |
2396 } | 2398 } |
2397 | 2399 |
2398 } // namespace views | 2400 } // namespace views |
OLD | NEW |