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

Unified Diff: ash/wm/workspace/workspace_layout_manager2.cc

Issue 10878079: Changes workspace code to only move windows when the work area changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove include Created 8 years, 4 months 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
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager2.h ('k') | ash/wm/workspace/workspace_manager2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_layout_manager2.cc
diff --git a/ash/wm/workspace/workspace_layout_manager2.cc b/ash/wm/workspace/workspace_layout_manager2.cc
index 763759e113f6b71cf0237c4f711977ef1f1fe56e..3352e30f0f24e421d1380a3bd69a1d73855369f0 100644
--- a/ash/wm/workspace/workspace_layout_manager2.cc
+++ b/ash/wm/workspace/workspace_layout_manager2.cc
@@ -21,7 +21,6 @@
#include "ui/aura/window_observer.h"
#include "ui/base/event.h"
#include "ui/base/ui_base_types.h"
-#include "ui/gfx/rect.h"
using aura::Window;
@@ -49,7 +48,9 @@ gfx::Rect BoundsWithScreenEdgeVisible(
WorkspaceLayoutManager2::WorkspaceLayoutManager2(Workspace2* workspace)
: root_window_(workspace->window()->GetRootWindow()),
- workspace_(workspace) {
+ workspace_(workspace),
+ work_area_(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
+ workspace->window()->parent())) {
Shell::GetInstance()->AddShellObserver(this);
root_window_->AddRootWindowObserver(this);
root_window_->AddObserver(this);
@@ -115,8 +116,12 @@ void WorkspaceLayoutManager2::OnRootWindowResized(const aura::RootWindow* root,
}
void WorkspaceLayoutManager2::OnDisplayWorkAreaInsetsChanged() {
- if (workspace_manager()->active_workspace_ == workspace_)
- AdjustWindowSizesForScreenChange();
+ if (workspace_manager()->active_workspace_ == workspace_) {
+ const gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
+ workspace_->window()->parent()));
+ if (work_area != work_area_)
+ AdjustWindowSizesForScreenChange();
+ }
}
void WorkspaceLayoutManager2::OnWindowPropertyChanged(Window* window,
@@ -198,6 +203,8 @@ void WorkspaceLayoutManager2::ShowStateChanged(
}
void WorkspaceLayoutManager2::AdjustWindowSizesForScreenChange() {
+ work_area_ = ScreenAsh::GetDisplayWorkAreaBoundsInParent(
+ workspace_->window()->parent());
// If a user plugs an external display into a laptop running Aura the
// display size will change. Maximized windows need to resize to match.
// We also do this when developers running Aura on a desktop manually resize
@@ -212,11 +219,9 @@ void WorkspaceLayoutManager2::AdjustWindowSizesForScreenChange() {
void WorkspaceLayoutManager2::AdjustWindowSizeForScreenChange(Window* window) {
if (!SetMaximizedOrFullscreenBounds(window)) {
- // The work area may be smaller than the full screen.
- gfx::Rect display_rect =
- ScreenAsh::GetDisplayWorkAreaBoundsInParent(window->parent()->parent());
- // Put as much of the window as possible within the display area.
- window->SetBounds(window->bounds().AdjustToFit(display_rect));
+ // The work area may be smaller than the full screen. Put as much of the
+ // window as possible within the display area.
+ window->SetBounds(window->bounds().AdjustToFit(work_area_));
}
}
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager2.h ('k') | ash/wm/workspace/workspace_manager2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698