diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 22:23:07 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 22:23:07 +0000 |
commit | 4c9b24cce158bb1ce97c34af55ad865b86499719 (patch) | |
tree | c147ac2d85c1008718adcecf77925940bd416b50 /chrome | |
parent | 5be424c82a3ea9ec7550a3d2f00bc2ce57a88583 (diff) | |
download | chromium_src-4c9b24cce158bb1ce97c34af55ad865b86499719.zip chromium_src-4c9b24cce158bb1ce97c34af55ad865b86499719.tar.gz chromium_src-4c9b24cce158bb1ce97c34af55ad865b86499719.tar.bz2 |
Revert r9953 since it caused regressions like:
http://crbug.com/8287
Eyeballing the code in RootView, this change seems wrong.
Review URL: http://codereview.chromium.org/40124
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10929 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 1 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 5 | ||||
-rw-r--r-- | chrome/views/event.h | 5 | ||||
-rw-r--r-- | chrome/views/root_view.cc | 28 | ||||
-rw-r--r-- | chrome/views/view.cc | 3 | ||||
-rw-r--r-- | chrome/views/widget_win.cc | 33 | ||||
-rw-r--r-- | chrome/views/widget_win.h | 5 | ||||
-rw-r--r-- | chrome/views/window.cc | 2 |
8 files changed, 26 insertions, 56 deletions
diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index ede0848..932fd32 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -185,6 +185,7 @@ class TabCloseButton : public views::Button { virtual ~TabCloseButton() {} virtual bool OnMousePressed(const views::MouseEvent& event) { + LOG(WARNING) << "MOUSE PRESSED"; return !event.IsOnlyMiddleMouseButton(); } diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index c256a82..cfb9a50 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -503,6 +503,11 @@ bool TabStrip::PointIsWithinWindowCaption(const gfx::Point& point) { if (v == this) return true; + // If the point is within the bounds of a Tab, the point can be considered + // part of the caption if there are no available drag operations for the Tab. + if (v->GetClassName() == Tab::kTabClassName && !HasAvailableDragActions()) + return true; + // Check to see if the point is within the non-button parts of the new tab // button. The button has a non-rectangular shape, so if it's not in the // visual portions of the button we treat it as a click to the caption. diff --git a/chrome/views/event.h b/chrome/views/event.h index 6a6501e..35ebfbe 100644 --- a/chrome/views/event.h +++ b/chrome/views/event.h @@ -156,10 +156,7 @@ class LocatedEvent : public Event { class MouseEvent : public LocatedEvent { public: // Flags specific to mouse events - enum MouseEventFlags { - EF_IS_DOUBLE_CLICK = 1 << 16, - EF_IS_NON_CLIENT = 1 << 17 - }; + enum MouseEventFlags { EF_IS_DOUBLE_CLICK = 1 << 16 }; // Create a new mouse event MouseEvent(EventType type, int x, int y, int flags) diff --git a/chrome/views/root_view.cc b/chrome/views/root_view.cc index 8955732..4f5097d 100644 --- a/chrome/views/root_view.cc +++ b/chrome/views/root_view.cc @@ -269,19 +269,8 @@ void RootView::SetFocusOnMousePressed(bool f) { } bool RootView::OnMousePressed(const MouseEvent& e) { - static View* last_click_handler = 0; - - // This function is not to handle non-client messages, so we return that - // we are not handling it quickly except for the double-click because we - // need to absorb it when it occurs on a different view than its single - // click part. - if ((e.GetFlags() & MouseEvent::EF_IS_NON_CLIENT) && - !(e.GetFlags() & MouseEvent::EF_IS_DOUBLE_CLICK)) { - last_click_handler = 0; - return false; - } - UpdateCursor(e); + SetMouseLocationAndFlags(e); // If mouse_pressed_handler_ is non null, we are currently processing @@ -311,8 +300,6 @@ bool RootView::OnMousePressed(const MouseEvent& e) { const MouseEvent mouse_pressed_event(e, this, mouse_pressed_handler_); drag_info.Reset(); const bool handled = - (!(e.GetFlags() & MouseEvent::EF_IS_DOUBLE_CLICK) || - (mouse_move_handler_ == last_click_handler)) && mouse_pressed_handler_->ProcessMousePressed(mouse_pressed_event, &drag_info); @@ -329,10 +316,8 @@ bool RootView::OnMousePressed(const MouseEvent& e) { // If the view handled the event, leave mouse_pressed_handler_ set and // return true, which will cause subsequent drag/release events to get // forwarded to that view. - if (handled) { - last_click_handler = mouse_pressed_handler_; + if (handled) return true; - } } // Reset mouse_pressed_handler_ to indicate that no processing is occurring. @@ -348,15 +333,6 @@ bool RootView::OnMousePressed(const MouseEvent& e) { NOTIMPLEMENTED(); #endif } - - // If we go through the whole hierarchy and we did not find the same handler - // for the double-click as we did for the single-click, then mark it as - // handled to eat up any double-click that ends up in a different location - // than its single-click part. - if (last_click_handler && e.GetFlags() & MouseEvent::EF_IS_DOUBLE_CLICK) - hit_disabled_view = true; - - last_click_handler = 0; return hit_disabled_view; } diff --git a/chrome/views/view.cc b/chrome/views/view.cc index 395eabc..e0fc3573 100644 --- a/chrome/views/view.cc +++ b/chrome/views/view.cc @@ -461,8 +461,7 @@ bool View::ProcessMousePressed(const MouseEvent& e, DragInfo* drag_info) { drag_operations = GetDragOperations(e.x(), e.y()); else drag_operations = 0; - ContextMenuController* context_menu_controller = - e.IsRightMouseButton()? context_menu_controller_ : 0; + ContextMenuController* context_menu_controller = context_menu_controller_; const bool result = OnMousePressed(e); // WARNING: we may have been deleted, don't use any View variables; diff --git a/chrome/views/widget_win.cc b/chrome/views/widget_win.cc index d89bcd2..85f81c8 100644 --- a/chrome/views/widget_win.cc +++ b/chrome/views/widget_win.cc @@ -533,7 +533,7 @@ void WidgetWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { } void WidgetWin::OnLButtonDown(UINT flags, const CPoint& point) { - ProcessMousePressed(point, flags | MK_LBUTTON, false, false); + ProcessMousePressed(point, flags | MK_LBUTTON, false); } void WidgetWin::OnLButtonUp(UINT flags, const CPoint& point) { @@ -541,11 +541,11 @@ void WidgetWin::OnLButtonUp(UINT flags, const CPoint& point) { } void WidgetWin::OnLButtonDblClk(UINT flags, const CPoint& point) { - ProcessMousePressed(point, flags | MK_LBUTTON, true, false); + ProcessMousePressed(point, flags | MK_LBUTTON, true); } void WidgetWin::OnMButtonDown(UINT flags, const CPoint& point) { - ProcessMousePressed(point, flags | MK_MBUTTON, false, false); + ProcessMousePressed(point, flags | MK_MBUTTON, false); } void WidgetWin::OnMButtonUp(UINT flags, const CPoint& point) { @@ -553,7 +553,7 @@ void WidgetWin::OnMButtonUp(UINT flags, const CPoint& point) { } void WidgetWin::OnMButtonDblClk(UINT flags, const CPoint& point) { - ProcessMousePressed(point, flags | MK_MBUTTON, true, false); + ProcessMousePressed(point, flags | MK_MBUTTON, true); } LRESULT WidgetWin::OnMouseActivate(HWND window, UINT hittest_code, @@ -588,11 +588,11 @@ LRESULT WidgetWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) { } void WidgetWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) { - SetMsgHandled(ProcessMousePressed(point, flags | MK_LBUTTON, true, true)); + SetMsgHandled(FALSE); } void WidgetWin::OnNCLButtonDown(UINT flags, const CPoint& point) { - SetMsgHandled(ProcessMousePressed(point, flags | MK_LBUTTON, false, true)); + SetMsgHandled(FALSE); } void WidgetWin::OnNCLButtonUp(UINT flags, const CPoint& point) { @@ -600,11 +600,11 @@ void WidgetWin::OnNCLButtonUp(UINT flags, const CPoint& point) { } void WidgetWin::OnNCMButtonDblClk(UINT flags, const CPoint& point) { - SetMsgHandled(ProcessMousePressed(point, flags | MK_MBUTTON, true, true)); + SetMsgHandled(FALSE); } void WidgetWin::OnNCMButtonDown(UINT flags, const CPoint& point) { - SetMsgHandled(ProcessMousePressed(point, flags | MK_MBUTTON, false, true)); + SetMsgHandled(FALSE); } void WidgetWin::OnNCMButtonUp(UINT flags, const CPoint& point) { @@ -629,11 +629,11 @@ LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) { } void WidgetWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) { - SetMsgHandled(ProcessMousePressed(point, flags | MK_RBUTTON, true, true)); + SetMsgHandled(FALSE); } void WidgetWin::OnNCRButtonDown(UINT flags, const CPoint& point) { - SetMsgHandled(ProcessMousePressed(point, flags | MK_RBUTTON, false, true)); + SetMsgHandled(FALSE); } void WidgetWin::OnNCRButtonUp(UINT flags, const CPoint& point) { @@ -659,7 +659,7 @@ void WidgetWin::OnPaint(HDC dc) { } void WidgetWin::OnRButtonDown(UINT flags, const CPoint& point) { - ProcessMousePressed(point, flags | MK_RBUTTON, false, false); + ProcessMousePressed(point, flags | MK_RBUTTON, false); } void WidgetWin::OnRButtonUp(UINT flags, const CPoint& point) { @@ -667,7 +667,7 @@ void WidgetWin::OnRButtonUp(UINT flags, const CPoint& point) { } void WidgetWin::OnRButtonDblClk(UINT flags, const CPoint& point) { - ProcessMousePressed(point, flags | MK_RBUTTON, true, false); + ProcessMousePressed(point, flags | MK_RBUTTON, true); } void WidgetWin::OnSettingChange(UINT flags, const wchar_t* section) { @@ -718,21 +718,16 @@ void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) { } } -bool WidgetWin::ProcessMousePressed(const CPoint& point, - UINT flags, - bool dbl_click, - bool non_client) { +bool WidgetWin::ProcessMousePressed(const CPoint& point, UINT flags, + bool dbl_click) { last_mouse_event_was_move_ = false; // Windows gives screen coordinates for nonclient events, while the RootView // expects window coordinates; convert if necessary. gfx::Point converted_point(point); - if (non_client) - View::ConvertPointToView(NULL, root_view_.get(), &converted_point); MouseEvent mouse_pressed(Event::ET_MOUSE_PRESSED, converted_point.x(), converted_point.y(), (dbl_click ? MouseEvent::EF_IS_DOUBLE_CLICK : 0) | - (non_client ? MouseEvent::EF_IS_NON_CLIENT : 0) | Event::ConvertWindowsFlags(flags)); if (root_view_->OnMousePressed(mouse_pressed)) { is_mouse_down_ = true; diff --git a/chrome/views/widget_win.h b/chrome/views/widget_win.h index 1e6e7c5..9c9a19f 100644 --- a/chrome/views/widget_win.h +++ b/chrome/views/widget_win.h @@ -486,10 +486,7 @@ class WidgetWin : public Widget, // Actually handle mouse events. These functions are called by subclasses who // override the message handlers above to do the actual real work of handling // the event in the View system. - bool ProcessMousePressed(const CPoint& point, - UINT flags, - bool dbl_click, - bool non_client); + bool ProcessMousePressed(const CPoint& point, UINT flags, bool dbl_click); void ProcessMouseDragged(const CPoint& point, UINT flags); void ProcessMouseReleased(const CPoint& point, UINT flags); void ProcessMouseMoved(const CPoint& point, UINT flags, bool is_nonclient); diff --git a/chrome/views/window.cc b/chrome/views/window.cc index 0deffd3..12f7d9a 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -1127,7 +1127,7 @@ void Window::ProcessNCMousePress(const CPoint& point, int flags) { if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) message_flags |= MK_SHIFT; message_flags |= flags; - ProcessMousePressed(temp, message_flags, false, false); + ProcessMousePressed(temp, message_flags, false); } LRESULT Window::CallDefaultNCActivateHandler(BOOL active) { |