Commit 6896c8a2 authored by Min Chen's avatar Min Chen Committed by Commit Bot

The drag distance of the dragged window should based on work area.

We should drop the drag window into overview if it has been dragged
further than half from the top of the work area to the top of the drop
target. The old logic consider the drag distance based on the top of the
display is not correct. Since the top of the display is not always
equals to the top of the work area. e.g, enable dock magnifier will put
a magnifier window in the top area of the display which will change the
work area.

Bug: 866680
Change-Id: I8b31c68501a36ed7fd82650a93145475f8c84e5c
Reviewed-on: https://chromium-review.googlesource.com/c/1285353
Commit-Queue: Min Chen <minch@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600453}
parent c5b38bba
......@@ -379,9 +379,15 @@ bool TabletModeWindowDragDelegate::ShouldDropWindowIntoOverview(
if (is_split_view_active)
return is_drop_target_selected;
const gfx::Rect work_area_bounds =
display::Screen::GetScreen()
->GetDisplayNearestWindow(dragged_window_)
.work_area();
return is_drop_target_selected ||
location_in_screen.y() >= kDragPositionToOverviewRatio *
drop_target->GetTransformedBounds().y();
(location_in_screen.y() - work_area_bounds.y()) >=
kDragPositionToOverviewRatio *
(drop_target->GetTransformedBounds().y() -
work_area_bounds.y());
}
bool TabletModeWindowDragDelegate::ShouldFlingIntoOverview(
......
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