summaryrefslogtreecommitdiffstats
path: root/ui/aura_shell
diff options
context:
space:
mode:
Diffstat (limited to 'ui/aura_shell')
-rw-r--r--ui/aura_shell/workspace/workspace.cc5
-rw-r--r--ui/aura_shell/workspace/workspace_manager.cc17
2 files changed, 14 insertions, 8 deletions
diff --git a/ui/aura_shell/workspace/workspace.cc b/ui/aura_shell/workspace/workspace.cc
index 5623e43..8e9f2cd 100644
--- a/ui/aura_shell/workspace/workspace.cc
+++ b/ui/aura_shell/workspace/workspace.cc
@@ -60,7 +60,6 @@ void Workspace::RemoveWindow(aura::Window* window) {
Layout(NULL);
}
-
bool Workspace::Contains(aura::Window* window) const {
return std::find(windows_.begin(), windows_.end(), window) != windows_.end();
}
@@ -74,7 +73,7 @@ void Workspace::Layout(aura::Window* no_animation) {
int total_width = 0;
for (aura::Window::Windows::const_iterator i = windows_.begin();
i != windows_.end();
- i++) {
+ ++i) {
if (total_width)
total_width += kWindowHorizontalMargin;
// TODO(oshima): use restored bounds.
@@ -85,7 +84,7 @@ void Workspace::Layout(aura::Window* no_animation) {
int dx = (work_area.width() - total_width) / 2;
for (aura::Window::Windows::iterator i = windows_.begin();
i != windows_.end();
- i++) {
+ ++i) {
MoveWindowTo(*i,
gfx::Point(work_area.x() + dx, work_area.y()),
no_animation != *i);
diff --git a/ui/aura_shell/workspace/workspace_manager.cc b/ui/aura_shell/workspace/workspace_manager.cc
index 410ace1..f7a463f 100644
--- a/ui/aura_shell/workspace/workspace_manager.cc
+++ b/ui/aura_shell/workspace/workspace_manager.cc
@@ -92,7 +92,6 @@ void WorkspaceManager::SetOverview(bool overview) {
if (is_overview_ == overview)
return;
is_overview_ = overview;
- gfx::Rect bounds = viewport_->GetTargetBounds();
ui::Transform transform;
if (is_overview_) {
@@ -108,10 +107,18 @@ void WorkspaceManager::SetOverview(bool overview) {
transform.SetScale(scale, scale);
int overview_width = viewport_->bounds().width() * scale;
- int dx = overview_width < workspace_size_.width() ?
- (workspace_size_.width() - overview_width) / 2 : 0;
-
- transform.SetTranslateX(-viewport_->GetTargetBounds().x() + dx);
+ int dx = 0;
+ if (overview_width < workspace_size_.width()) {
+ dx = (workspace_size_.width() - overview_width) / 2;
+ } else if (active_workspace_) {
+ // Center the active workspace.
+ int active_workspace_mid_x = (active_workspace_->bounds().x() +
+ active_workspace_->bounds().width() / 2) * scale;
+ dx = workspace_size_.width() / 2 - active_workspace_mid_x;
+ dx = std::min(0, std::max(dx, workspace_size_.width() - overview_width));
+ }
+
+ transform.SetTranslateX(dx);
transform.SetTranslateY(workspace_size_.height() * (1.0f - scale) / 2);
} else {
transform.SetTranslateX(-active_workspace_->bounds().x());