diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 14:14:45 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 14:14:45 +0000 |
commit | 2527579cd4d7ca238982e00b6ebfbc1a0988acf4 (patch) | |
tree | 87d2a6f637d16ea49d441ec79c378087284a9d7f /ui/views/widget/native_widget_win.cc | |
parent | caf99866fa13ab0321d38aaed8c1e7e4759e2f69 (diff) | |
download | chromium_src-2527579cd4d7ca238982e00b6ebfbc1a0988acf4.zip chromium_src-2527579cd4d7ca238982e00b6ebfbc1a0988acf4.tar.gz chromium_src-2527579cd4d7ca238982e00b6ebfbc1a0988acf4.tar.bz2 |
Revert 131761 - Mouse events, touch events, or both can be locked to a target.
Broke Win-Aura compile.
NativeWidgetPrivate and Window event capture related commands now take a
set of flags, indicating what event types to lock. Current options are
CW_LOCK_MOUSE and CW_LOCK_TOUCH.
BUG=117554
TEST=WindowTest.TouchCaptureTests, WindowTest.CaptureTests
Review URL: http://codereview.chromium.org/9838011
TBR=tdresser@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10052012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget/native_widget_win.cc')
-rw-r--r-- | ui/views/widget/native_widget_win.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index fc85a88..a128771 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -642,21 +642,17 @@ void NativeWidgetWin::SendNativeAccessibilityEvent( GetNativeView(), OBJID_CLIENT, child_id); } -void NativeWidgetWin::SetCapture(unsigned int flags) { - if (flags & ui::CW_LOCK_MOUSE) { - DCHECK(!HasCapture(ui::CW_LOCK_MOUSE)); - ::SetCapture(hwnd()); - } +void NativeWidgetWin::SetMouseCapture() { + DCHECK(!HasMouseCapture()); + SetCapture(hwnd()); } -void NativeWidgetWin::ReleaseCapture() { - ::ReleaseCapture(); +void NativeWidgetWin::ReleaseMouseCapture() { + ReleaseCapture(); } -bool NativeWidgetWin::HasCapture(unsigned int flags) const { - if (flags == ui::CW_LOCK_MOUSE) - return ::GetCapture() == hwnd(); - return false; +bool NativeWidgetWin::HasMouseCapture() const { + return GetCapture() == hwnd(); } InputMethod* NativeWidgetWin::CreateInputMethod() { @@ -1128,7 +1124,7 @@ void NativeWidgetWin::SetInactiveRenderingDisabled(bool value) { } Widget::MoveLoopResult NativeWidgetWin::RunMoveLoop() { - ReleaseCapture(); + ReleaseMouseCapture(); MoveLoopMouseWatcher watcher(this); SendMessage(hwnd(), WM_SYSCOMMAND, SC_MOVE | 0x0002, GetMessagePos()); // Windows doesn't appear to offer a way to determine whether the user @@ -1564,10 +1560,10 @@ LRESULT NativeWidgetWin::OnMouseRange(UINT message, } else if (message == WM_NCRBUTTONDOWN && (w_param == HTCAPTION || w_param == HTSYSMENU)) { is_right_mouse_pressed_on_caption_ = true; - // We SetCapture() to ensure we only show the menu when the button + // We SetMouseCapture() to ensure we only show the menu when the button // down and up are both on the caption. Note: this causes the button up to // be WM_RBUTTONUP instead of WM_NCRBUTTONUP. - SetCapture(ui::CW_LOCK_MOUSE); + SetMouseCapture(); } MSG msg = { hwnd(), message, w_param, l_param, 0, @@ -1578,7 +1574,7 @@ LRESULT NativeWidgetWin::OnMouseRange(UINT message, if (tooltip_manager_.get()) tooltip_manager_->OnMouse(message, w_param, l_param); - if (event.type() == ui::ET_MOUSE_MOVED && !HasCapture(ui::CW_LOCK_MOUSE)) { + if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) { // Windows only fires WM_MOUSELEAVE events if the application begins // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. |