diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 20:38:03 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 20:38:03 +0000 |
commit | 66e5af67ff42c6db608aad2bc87393c468c8a642 (patch) | |
tree | 7ba907d99e1c86e0680ef8e4282cc9973a2d36bd /ui | |
parent | 5332b834259dbab2ebbefba1944824df469139d4 (diff) | |
download | chromium_src-66e5af67ff42c6db608aad2bc87393c468c8a642.zip chromium_src-66e5af67ff42c6db608aad2bc87393c468c8a642.tar.gz chromium_src-66e5af67ff42c6db608aad2bc87393c468c8a642.tar.bz2 |
Consolidate Widget Event code, other cleanup.
Rename *NativeCapture to *MouseCapture.
Rename and move ShouldReleaseCaptureOnMouseReleased.
Move static flag function to Event.
BUG=72040
TEST=Mouse interaction on win & linux_views.
Review URL: http://codereview.chromium.org/6756043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/widget/native_widget_win.cc | 23 | ||||
-rw-r--r-- | ui/views/widget/native_widget_win.h | 4 | ||||
-rw-r--r-- | ui/views/widget/widget.cc | 4 |
3 files changed, 7 insertions, 24 deletions
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index ac6cfed..0d2d998 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -349,15 +349,13 @@ void NativeWidgetWin::OnInitMenuPopup(HMENU menu, UINT position, LRESULT NativeWidgetWin::OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param) { - MSG msg; - MakeMSG(&msg, message, w_param, l_param); + MSG msg = { message, w_param, l_param }; SetMsgHandled(listener_->OnKeyEvent(KeyEvent(msg))); return 0; } LRESULT NativeWidgetWin::OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param) { - MSG msg; - MakeMSG(&msg, message, w_param, l_param); + MSG msg = { message, w_param, l_param }; SetMsgHandled(listener_->OnKeyEvent(KeyEvent(msg))); return 0; } @@ -376,8 +374,7 @@ LRESULT NativeWidgetWin::OnMouseActivate(HWND window, UINT hittest_code, LRESULT NativeWidgetWin::OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param) { // TODO(beng): tooltip - MSG msg; - MakeMSG(&msg, message, w_param, l_param); + MSG msg = { message, w_param, l_param }; SetMsgHandled(listener_->OnMouseEvent(MouseEvent(msg))); // Reset our tracking flag so that future mouse movement over this WidgetWin @@ -594,8 +591,7 @@ void NativeWidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) { bool NativeWidgetWin::ProcessMouseRange(UINT message, WPARAM w_param, LPARAM l_param, bool non_client) { - MSG msg; - MakeMSG(&msg, message, w_param, l_param); + MSG msg = { message, w_param, l_param }; if (message == WM_MOUSEWHEEL) { // Reroute the mouse-wheel to the window under the mouse pointer if // applicable. @@ -612,17 +608,6 @@ bool NativeWidgetWin::ProcessMouseRange(UINT message, WPARAM w_param, return listener_->OnMouseEvent(MouseEvent(msg)); } -void NativeWidgetWin::MakeMSG(MSG* msg, UINT message, WPARAM w_param, - LPARAM l_param, DWORD time, LONG x, LONG y) const { - msg->hwnd = hwnd(); - msg->message = message; - msg->wParam = w_param; - msg->lParam = l_param; - msg->time = time; - msg->pt.x = x; - msg->pt.y = y; -} - void NativeWidgetWin::CloseNow() { DestroyWindow(hwnd()); } diff --git a/ui/views/widget/native_widget_win.h b/ui/views/widget/native_widget_win.h index 1d85405..bdd2e74 100644 --- a/ui/views/widget/native_widget_win.h +++ b/ui/views/widget/native_widget_win.h @@ -237,10 +237,6 @@ class NativeWidgetWin : public NativeWidget, void ProcessMouseMoved(const CPoint& point, UINT flags, bool is_nonclient); void ProcessMouseExited(); - // Fills out a MSG struct with the supplied values. - void MakeMSG(MSG* msg, UINT message, WPARAM w_param, LPARAM l_param, - DWORD time = 0, LONG x = 0, LONG y = 0) const; - void CloseNow(); bool IsLayeredWindow() const; diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 3b2746a..9bb4513 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -159,9 +159,9 @@ void Widget::OnMouseCaptureLost() { } bool Widget::OnMouseEvent(const MouseEvent& event) { - last_mouse_event_was_move_ = false; switch (event.type()) { case ui::Event::ET_MOUSE_PRESSED: + last_mouse_event_was_move_ = false; if (root_view_->OnMousePressed(event)) { is_mouse_button_pressed_ = true; if (!native_widget_->HasMouseCapture()) @@ -178,6 +178,7 @@ bool Widget::OnMouseEvent(const MouseEvent& event) { native_widget_->ShouldReleaseCaptureOnMouseReleased()) { native_widget_->ReleaseMouseCapture(); } + last_mouse_event_was_move_ = false; is_mouse_button_pressed_ = false; root_view_->OnMouseReleased(event); return true; @@ -199,6 +200,7 @@ bool Widget::OnMouseEvent(const MouseEvent& event) { } break; case ui::Event::ET_MOUSE_EXITED: + last_mouse_event_was_move_ = false; root_view_->OnMouseExited(event); return true; } |