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/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 #include "ui/views/widget/widget_hwnd_utils.h" | 51 #include "ui/views/widget/widget_hwnd_utils.h" |
52 #include "ui/views/window/native_frame_view.h" | 52 #include "ui/views/window/native_frame_view.h" |
53 | 53 |
54 #if !defined(USE_AURA) | 54 #if !defined(USE_AURA) |
55 #include "base/command_line.h" | 55 #include "base/command_line.h" |
56 #include "ui/base/ui_base_switches.h" | 56 #include "ui/base/ui_base_switches.h" |
57 #endif | 57 #endif |
58 | 58 |
59 #pragma comment(lib, "dwmapi.lib") | 59 #pragma comment(lib, "dwmapi.lib") |
60 | 60 |
61 // From msdn: | |
62 #define MOUSEEVENTF_FROMTOUCH 0xFF515700 | |
63 | |
64 using ui::ViewProp; | 61 using ui::ViewProp; |
65 | 62 |
66 namespace views { | 63 namespace views { |
67 | 64 |
68 namespace { | 65 namespace { |
69 | 66 |
70 // MoveLoopMouseWatcher is used to determine if the user canceled or completed a | 67 // MoveLoopMouseWatcher is used to determine if the user canceled or completed a |
71 // move. win32 doesn't appear to offer a way to determine the result of a move, | 68 // move. win32 doesn't appear to offer a way to determine the result of a move, |
72 // so we install hooks to determine if we got a mouse up and assume the move | 69 // so we install hooks to determine if we got a mouse up and assume the move |
73 // completed. | 70 // completed. |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1624 is_right_mouse_pressed_on_caption_ = true; | 1621 is_right_mouse_pressed_on_caption_ = true; |
1625 // We SetCapture() to ensure we only show the menu when the button | 1622 // We SetCapture() to ensure we only show the menu when the button |
1626 // down and up are both on the caption. Note: this causes the button up to | 1623 // down and up are both on the caption. Note: this causes the button up to |
1627 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP. | 1624 // be WM_RBUTTONUP instead of WM_NCRBUTTONUP. |
1628 SetCapture(); | 1625 SetCapture(); |
1629 } | 1626 } |
1630 | 1627 |
1631 MSG msg = { hwnd(), message, w_param, l_param, 0, | 1628 MSG msg = { hwnd(), message, w_param, l_param, 0, |
1632 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; | 1629 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; |
1633 MouseEvent event(msg); | 1630 MouseEvent event(msg); |
1634 // Only button up/down have MOUSEEVENTF_FROMTOUCH set. | 1631 if (!touch_ids_.empty() || base::win::IsMouseEventFromTouch(message)) { |
flackr
2012/07/24 19:53:04
nit: no braces for single line if statement.
girard
2012/07/24 23:54:55
Done.
| |
1635 if (!touch_ids_.empty() || | |
1636 ((message == WM_LBUTTONDOWN || message == WM_LBUTTONUP || | |
1637 message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) && | |
1638 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == | |
1639 MOUSEEVENTF_FROMTOUCH)) { | |
1640 event.set_flags(event.flags() | ui::EF_FROM_TOUCH); | 1632 event.set_flags(event.flags() | ui::EF_FROM_TOUCH); |
1641 } | 1633 } |
1642 | 1634 |
1643 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) | 1635 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) |
1644 if (tooltip_manager_.get()) | 1636 if (tooltip_manager_.get()) |
1645 tooltip_manager_->OnMouse(message, w_param, l_param); | 1637 tooltip_manager_->OnMouse(message, w_param, l_param); |
1646 | 1638 |
1647 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture()) { | 1639 if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture()) { |
1648 // Windows only fires WM_MOUSELEAVE events if the application begins | 1640 // Windows only fires WM_MOUSELEAVE events if the application begins |
1649 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. | 1641 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2767 // static | 2759 // static |
2768 bool NativeWidgetPrivate::IsTouchDown() { | 2760 bool NativeWidgetPrivate::IsTouchDown() { |
2769 // This currently isn't necessary because we're not generating touch events on | 2761 // This currently isn't necessary because we're not generating touch events on |
2770 // windows. When we do, this will need to be updated. | 2762 // windows. When we do, this will need to be updated. |
2771 return false; | 2763 return false; |
2772 } | 2764 } |
2773 | 2765 |
2774 } // namespace internal | 2766 } // namespace internal |
2775 | 2767 |
2776 } // namespace views | 2768 } // namespace views |
OLD | NEW |