Commit c2976ff8 authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

cros: Fix launcher drag state after multi touch menu dismissal

Handle the case where the menu is not dismissed due to a drag sequence.
This was not handled gracefully, and resulted in a bad drag state on the
app icon.

finger. Then touch the screen somewhere else.

Example: Show a menu on an app icon via long press, don't release the
Bug: 876440
Change-Id: I8ebde0669aec7b7925fb1c855008cbfbaa8b3683
Reviewed-on: https://chromium-review.googlesource.com/c/1340822Reviewed-by: default avatarWeidong Guo <weidongg@chromium.org>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609027}
parent 1d2043b9
...@@ -381,7 +381,10 @@ void AppListItemView::OnTouchDragTimer( ...@@ -381,7 +381,10 @@ void AppListItemView::OnTouchDragTimer(
} }
void AppListItemView::CancelContextMenu() { void AppListItemView::CancelContextMenu() {
if (context_menu_) if (!context_menu_)
return;
menu_close_initiated_from_drag_ = true;
context_menu_->Cancel(); context_menu_->Cancel();
} }
...@@ -799,6 +802,14 @@ void AppListItemView::AnimationProgressed(const gfx::Animation* animation) { ...@@ -799,6 +802,14 @@ void AppListItemView::AnimationProgressed(const gfx::Animation* animation) {
} }
void AppListItemView::OnMenuClosed() { void AppListItemView::OnMenuClosed() {
if (!menu_close_initiated_from_drag_) {
// If the menu was not closed due to a drag sequence(e.g. multi touch) reset
// the drag state.
SetState(STATE_NORMAL);
SetTouchDragging(false);
}
menu_close_initiated_from_drag_ = false;
OnBlur(); OnBlur();
} }
......
...@@ -260,6 +260,10 @@ class APP_LIST_EXPORT AppListItemView ...@@ -260,6 +260,10 @@ class APP_LIST_EXPORT AppListItemView
bool is_installing_ = false; bool is_installing_ = false;
bool is_highlighted_ = false; bool is_highlighted_ = false;
// Whether |context_menu_| was cancelled as the result of a continuous drag
// gesture.
bool menu_close_initiated_from_drag_ = false;
base::string16 tooltip_text_; base::string16 tooltip_text_;
// A timer to defer showing drag UI when mouse is pressed. // A timer to defer showing drag UI when mouse is pressed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment