Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2870)

Unified Diff: ash/wm/window_util.cc

Issue 79023009: Avoids centering docked windows, Unsnaps when centering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoids centering docked windows, Unsnaps when centering. (Added test) Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/window_util.cc
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 46a776a3d65c2e9a82a96b5e34a3d0f41d1b18ba..8d320a9c2e2acdccbcd66b3577787c18ffc49bcc 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -9,6 +9,7 @@
#include "ash/ash_constants.h"
#include "ash/shell.h"
#include "ash/wm/window_properties.h"
+#include "ash/wm/window_state.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
@@ -55,11 +56,18 @@ bool IsWindowMinimized(aura::Window* window) {
}
void CenterWindow(aura::Window* window) {
+ wm::WindowState* window_state = wm::GetWindowState(window);
+ if (!window_state->IsNormalShowState())
+ return;
const gfx::Display display =
Shell::GetScreen()->GetDisplayNearestWindow(window);
gfx::Rect center = display.work_area();
- center.ClampToCenteredSize(window->bounds().size());
- window->SetBoundsInScreen(center, display);
+ gfx::Size size = window_state->HasRestoreBounds() ?
+ window_state->GetRestoreBoundsInScreen().size() :
+ window->bounds().size();
+ center.ClampToCenteredSize(size);
+ window_state->SetRestoreBoundsInScreen(center);
+ window_state->Restore();
}
void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area,

Powered by Google App Engine
This is Rietveld 408576698