Commit 097ca56d authored by Tim Zheng's avatar Tim Zheng Committed by Commit Bot

Set window bounds once when moving display.

This change avoids set window bounds twice.

BUG=chromium:843001
TEST=Manual test on an eve device.

Change-Id: If08f8e4fd7b8e91db43f265fa8fdc46c3da6eb86
Reviewed-on: https://chromium-review.googlesource.com/1087844Reviewed-by: default avatarStefan Kuhne <skuhne@chromium.org>
Commit-Queue: Tim Zheng <timzheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564749}
parent 70881e87
......@@ -142,15 +142,15 @@ void CrostiniAppWindowShelfController::OnWindowPropertyChanged(
crostini_app_display_.GetDisplayIdForStartupId(*startup_id);
if (display_id == display::kInvalidDisplayId)
return;
gfx::Rect bounds = window->bounds();
display::Display display;
if (!display::Screen::GetScreen()->GetDisplayWithDisplayId(display_id,
&display))
return;
window->SetBoundsInScreen(window->GetBoundsInScreen(), display);
// The origin of the window is off after the above statement and needs to be
// reset. http://crbug.com/848970.
window->SetBounds(bounds);
gfx::Rect bounds = window->bounds();
gfx::Point origin = display.bounds().origin();
origin.Offset(bounds.x(), bounds.y());
bounds.set_origin(origin);
window->SetBoundsInScreen(bounds, display);
}
void CrostiniAppWindowShelfController::OnWindowVisibilityChanged(
......
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