Commit 900fea4d authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Pass gesture with screen coordinates to shelf from navigation widget

Shelf::ProcessGestureEvent expects an event with in-screen coordinates
(for example to properly calculate window transform during window drag
from shelf). Update ShelfNavigationWidget to pass gesture event copy
with the location in screen coordinates to Shelf::ProcessGestureEvent.

Updates ShelfLayoutManagerWindowDraggingTest.DraggedMRUWindow to verify
that the dragged window is scaled as expected during the drag, and to
test gesture starts from navigation and status area parts of the shelf.

BUG=1034145

Change-Id: I839c6daaaf7577f09444e8094a4fe55dc2502e77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1985132Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728021}
parent 9c065c31
This diff is collapsed.
......@@ -21,6 +21,7 @@
#include "ui/views/animation/bounds_animator.h"
#include "ui/views/background.h"
#include "ui/views/view.h"
#include "ui/wm/core/coordinate_conversion.h"
namespace ash {
namespace {
......@@ -267,7 +268,15 @@ bool ShelfNavigationWidget::OnNativeWidgetActivationChanged(bool active) {
}
void ShelfNavigationWidget::OnGestureEvent(ui::GestureEvent* event) {
if (shelf_->ProcessGestureEvent(*event)) {
// Shelf::ProcessGestureEvent expects an event whose location is in screen
// coordinates - create a copy of the event with the location in screen
// coordinate system.
ui::GestureEvent copy_event(*event);
gfx::Point location_in_screen(copy_event.location());
wm::ConvertPointToScreen(GetNativeWindow(), &location_in_screen);
copy_event.set_location(location_in_screen);
if (shelf_->ProcessGestureEvent(copy_event)) {
event->StopPropagation();
return;
}
......
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