Index: athena/wm/split_view_controller.cc |
diff --git a/athena/wm/split_view_controller.cc b/athena/wm/split_view_controller.cc |
index 36ce6c230ddff40b9de3dfd9c1509125463b01b6..b4b2dde0cdf815783bbb24579704342cce7cf9d0 100644 |
--- a/athena/wm/split_view_controller.cc |
+++ b/athena/wm/split_view_controller.cc |
@@ -18,6 +18,7 @@ |
#include "ui/gfx/display.h" |
#include "ui/gfx/screen.h" |
#include "ui/wm/core/window_util.h" |
+#include "ui/wm/public/activation_client.h" |
namespace athena { |
@@ -69,7 +70,8 @@ bool SplitViewController::IsSplitViewModeActive() const { |
} |
void SplitViewController::ActivateSplitMode(aura::Window* left, |
- aura::Window* right) { |
+ aura::Window* right, |
+ aura::Window* to_activate) { |
const aura::Window::Windows& windows = window_list_provider_->GetWindowList(); |
aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); |
if (state_ == ACTIVE) { |
@@ -103,10 +105,25 @@ void SplitViewController::ActivateSplitMode(aura::Window* left, |
if (right_window_ && right_window_ != left && right_window_ != right) |
to_hide_.push_back(right_window_); |
- SetState(ACTIVE); |
- right_window_ = right; |
left_window_ = left; |
+ right_window_ = right; |
+ |
+ SetState(ACTIVE); |
UpdateLayout(true); |
+ |
+ if (to_activate) |
+ wm::ActivateWindow(to_activate); |
sadrul
2014/09/23 16:18:32
Add a CHECK here that to_activate is one of left o
pkotwicz
2014/09/24 14:59:23
I have changed things around to make them clearer.
|
+ |
+ aura::client::ActivationClient* activation_client = |
+ aura::client::GetActivationClient(container_->GetRootWindow()); |
+ aura::Window* active_window = activation_client->GetActiveWindow(); |
+ |
+ if (active_window == left_window_) { |
+ window_list_provider_->StackWindowBehindTo(right_window_, left_window_); |
+ } else { |
+ CHECK_EQ(active_window, right_window_); |
+ window_list_provider_->StackWindowBehindTo(left_window_, right_window_); |
+ } |
} |
void SplitViewController::ReplaceWindow(aura::Window* window, |
@@ -117,12 +134,19 @@ void SplitViewController::ReplaceWindow(aura::Window* window, |
CHECK(replace_with != left_window_ && replace_with != right_window_); |
DCHECK(window_list_provider_->IsWindowInList(replace_with)); |
- if (window == left_window_) |
+ aura::Window* not_replaced = NULL; |
+ if (window == left_window_) { |
left_window_ = replace_with; |
- else |
+ not_replaced = right_window_; |
+ } else { |
right_window_ = replace_with; |
- wm::ActivateWindow(replace_with); |
+ not_replaced = left_window_; |
+ } |
UpdateLayout(false); |
+ |
+ wm::ActivateWindow(replace_with); |
+ window_list_provider_->StackWindowBehindTo(not_replaced, replace_with); |
+ |
window->SetTransform(gfx::Transform()); |
window->Hide(); |
} |
@@ -174,8 +198,6 @@ void SplitViewController::UpdateLayout(bool animate) { |
left_window_->Show(); |
right_window_->Show(); |
- window_list_provider_->MoveToFront(right_window_); |
- window_list_provider_->MoveToFront(left_window_); |
if (state_ == ACTIVE) { |
if (animate) { |