Chromium Code Reviews| Index: ash/shelf/shelf_view.cc |
| diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc |
| index c1774e56f0daed084efc866b40e8895b05562faa..c0fb7e43decacb9ec863aa76a524b88727b0bd99 100644 |
| --- a/ash/shelf/shelf_view.cc |
| +++ b/ash/shelf/shelf_view.cc |
| @@ -389,7 +389,8 @@ ShelfView::ShelfView(ShelfModel* model, |
| layout_manager_(manager), |
| overflow_mode_(false), |
| main_shelf_(NULL), |
| - dragged_off_from_overflow_to_shelf_(false) { |
| + dragged_off_from_overflow_to_shelf_(false), |
| + pressed_on_same_position_(false) { |
| DCHECK(model_); |
| bounds_animator_.reset(new views::BoundsAnimator(this)); |
| bounds_animator_->AddObserver(this); |
| @@ -1559,6 +1560,19 @@ void ShelfView::ShelfStatusChanged() { |
| void ShelfView::PointerPressedOnButton(views::View* view, |
| Pointer pointer, |
| const ui::LocatedEvent& event) { |
| + // Compare the current position with the previous one. |
| + // If |pressed_on_same_position_| equals true, which means the previous |
| + // pointer press was ignored, reset it to false to make sure the current |
| + // press event won't be ignored in ShelfView::ButtonPressed(...). Otherwise |
| + // if the current press position is the same with the previous one, ignore |
| + // the current press event. |
|
Mr4D (OOO till 08-26)
2014/12/02 21:40:12
You do not want to do this because of various reas
|
| + gfx::Point current_position = gfx::Point(event.x(), event.y()); |
| + if (pressed_on_same_position_) |
| + pressed_on_same_position_ = false; |
| + else if (pointer_pressed_position_ == current_position) |
| + pressed_on_same_position_ = true; |
| + pointer_pressed_position_ = current_position; |
| + |
| if (drag_view_) |
| return; |
| @@ -1668,6 +1682,11 @@ void ShelfView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
| if (!IsUsableEvent(event)) |
| return; |
| + // If the current press position is the same with the previous one, we ignore |
| + // this one. |
| + if (pressed_on_same_position_) |
| + return; |
| + |
| // Don't activate the item twice on double-click. Otherwise the window starts |
| // animating open due to the first click, then immediately minimizes due to |
| // the second click. The user most likely intended to open or minimize the |