Index: athena/wm/window_manager_impl.cc |
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc |
index bbc86735050d849dd93245c9822a90b518377661..b467d8279225e77ee731bde930b4b64b73b61982 100644 |
--- a/athena/wm/window_manager_impl.cc |
+++ b/athena/wm/window_manager_impl.cc |
@@ -14,9 +14,12 @@ |
#include "athena/wm/title_drag_controller.h" |
#include "athena/wm/window_list_provider_impl.h" |
#include "athena/wm/window_overview_mode.h" |
+#include "base/bind.h" |
#include "base/logging.h" |
#include "ui/aura/layout_manager.h" |
#include "ui/aura/window.h" |
+#include "ui/compositor/closure_animation_observer.h" |
+#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/gfx/display.h" |
#include "ui/gfx/screen.h" |
#include "ui/wm/core/shadow_controller.h" |
@@ -171,8 +174,8 @@ void WindowManagerImpl::SetInOverview(bool active) { |
active ? NULL : split_view_controller_.get()); |
if (active) { |
split_view_controller_->DeactivateSplitMode(); |
- FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
- OnOverviewModeEnter()); |
+ FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); |
+ |
// Re-stack all windows in the order defined by window_list_provider_. |
aura::Window::Windows window_list = window_list_provider_->GetWindowList(); |
aura::Window::Windows::iterator it; |
@@ -183,8 +186,7 @@ void WindowManagerImpl::SetInOverview(bool active) { |
} else { |
CHECK(!split_view_controller_->IsSplitViewModeActive()); |
overview_.reset(); |
- FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
- OnOverviewModeExit()); |
+ FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); |
} |
} |
@@ -265,11 +267,18 @@ void WindowManagerImpl::OnTitleDragStarted(aura::Window* window) { |
aura::Window* next_window = GetWindowBehind(window); |
if (!next_window) |
return; |
- // Make sure |window| is active. Also make sure that |next_window| is visible, |
- // and positioned to match the top-left edge of |window|. |
+ // Make sure |window| is active. |
wm::ActivateWindow(window); |
+ |
+ // Make sure |next_window| is visibile. |
next_window->Show(); |
+ |
+ // Position |next_window| correctly (left aligned if it's larger than |
+ // |window|, and center aligned otherwise). |
int dx = window->bounds().x() - next_window->bounds().x(); |
+ if (next_window->bounds().width() < window->bounds().width()) |
+ dx += (window->bounds().width() - next_window->bounds().width()) / 2; |
oshima
2014/08/20 13:41:59
could be just me and you may ignore but
dy -= (ne
sadrul
2014/08/20 22:34:24
Done.
|
+ |
if (dx) { |
gfx::Transform transform; |
transform.Translate(dx, 0); |
@@ -281,11 +290,30 @@ void WindowManagerImpl::OnTitleDragCompleted(aura::Window* window) { |
aura::Window* next_window = GetWindowBehind(window); |
if (!next_window) |
return; |
- if (split_view_controller_->IsSplitViewModeActive()) |
+ if (split_view_controller_->IsSplitViewModeActive()) { |
split_view_controller_->ReplaceWindow(window, next_window); |
- else |
+ wm::ActivateWindow(next_window); |
+ } else { |
+ ui::ScopedLayerAnimationSettings |
+ settings(next_window->layer()->GetAnimator()); |
+ settings.AddObserver(new ui::ClosureAnimationObserver( |
+ base::Bind(&aura::Window::SetBounds, |
+ base::Unretained(next_window), |
+ window->bounds()))); |
+ settings.AddObserver(new ui::ClosureAnimationObserver( |
+ base::Bind(&aura::Window::SetTransform, |
+ base::Unretained(next_window), |
+ gfx::Transform()))); |
oshima
2014/08/20 13:41:59
I'd be nice to have a utility observer to set the
sadrul
2014/08/20 22:34:24
Done.
|
+ |
+ gfx::Transform transform; |
+ transform.Scale(window->bounds().width() / next_window->bounds().width(), |
+ window->bounds().height() / next_window->bounds().height()); |
+ transform.Translate(window->bounds().x() - next_window->bounds().x(), 0); |
+ next_window->SetTransform(transform); |
+ |
OnSelectWindow(next_window); |
- wm::ActivateWindow(next_window); |
+ } |
+ window->Hide(); |
oshima
2014/08/20 13:41:59
Is this important now? looks like we show all wind
sadrul
2014/08/20 22:34:24
It's not important in the sense that not doing a H
|
} |
void WindowManagerImpl::OnTitleDragCanceled(aura::Window* window) { |
@@ -293,6 +321,7 @@ void WindowManagerImpl::OnTitleDragCanceled(aura::Window* window) { |
if (!next_window) |
return; |
next_window->SetTransform(gfx::Transform()); |
+ next_window->Hide(); |
} |
// static |