Commit 4fa8ff7e authored by Kevin Strohbehn's avatar Kevin Strohbehn Committed by Commit Bot

Handles mouse clicks between apps in apps grid, preventing app_list close

Bug: 894328
Change-Id: Ia12904740ef4f57643233d26710c704908cca1c8
Reviewed-on: https://chromium-review.googlesource.com/c/1309420Reviewed-by: default avatarWeidong Guo <weidongg@chromium.org>
Commit-Queue: Kevin Strohbehn <ginko@google.com>
Cr-Commit-Position: refs/heads/master@{#604435}
parent 51d19100
......@@ -1032,9 +1032,7 @@ void AppsGridView::OnGestureEvent(ui::GestureEvent* event) {
if (!contents_view_->app_list_view()->IsHomeLauncherEnabledInTabletMode() &&
(event->type() == ui::ET_GESTURE_TAP ||
event->type() == ui::ET_GESTURE_LONG_PRESS)) {
GridIndex nearest_tile_index =
GetNearestTileIndexForPoint(event->location());
if (IsValidIndex(nearest_tile_index))
if (EventIsBetweenOccupiedTiles(event))
event->SetHandled();
return;
}
......@@ -1063,6 +1061,16 @@ void AppsGridView::OnGestureEvent(ui::GestureEvent* event) {
}
}
bool AppsGridView::OnMousePressed(const ui::MouseEvent& event) {
return !contents_view_->app_list_view()
->IsHomeLauncherEnabledInTabletMode() &&
event.IsLeftMouseButton() && EventIsBetweenOccupiedTiles(&event);
}
bool AppsGridView::EventIsBetweenOccupiedTiles(const ui::LocatedEvent* event) {
return IsValidIndex(GetNearestTileIndexForPoint(event->location()));
}
void AppsGridView::Update() {
DCHECK(!selected_view_ && !drag_view_);
view_model_.Clear();
......
......@@ -195,6 +195,10 @@ class APP_LIST_EXPORT AppsGridView : public views::View,
// Overridden from ui::EventHandler:
void OnGestureEvent(ui::GestureEvent* event) override;
bool OnMousePressed(const ui::MouseEvent& event) override;
// Returns true if a touch or click lies between two occupied tiles.
bool EventIsBetweenOccupiedTiles(const ui::LocatedEvent* event);
// Stops the timer that triggers a page flip during a drag.
void StopPageFlipTimer();
......
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