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

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. 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())
pkotwicz 2013/11/21 23:46:50 I have trouble keeping show type and show state st
+ 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();
varkha 2013/11/21 22:53:55 Restore is needed here to properly reset window_sh
}
void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area,
« ash/accelerators/accelerator_controller.cc ('K') | « ash/accelerators/accelerator_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698