Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3268)

Unified Diff: ash/shelf/shelf_view.cc

Issue 772963002: Make the second click on the app shelf icon close the window-list bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698