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

Unified Diff: athena/wm/window_manager_impl.cc

Issue 468763002: athena: Fix switching windows with title-drag in split-view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | « athena/wm/title_drag_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/wm/window_manager_impl.cc
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc
index eaaa0cd44a1c38f11100d42406d3aef19e4da27f..e3bb2b281d521222e130fcd69acf6e53204607fa 100644
--- a/athena/wm/window_manager_impl.cc
+++ b/athena/wm/window_manager_impl.cc
@@ -247,23 +247,58 @@ bool WindowManagerImpl::OnAcceleratorFired(int command_id,
}
aura::Window* WindowManagerImpl::GetWindowBehind(aura::Window* window) {
- const aura::Window::Windows& windows = container_->children();
- aura::Window::Windows::const_iterator iter =
- std::find(windows.begin(), windows.end(), window);
- CHECK(iter != windows.end());
- return (iter == windows.begin()) ? NULL : *(iter - 1);
+ const aura::Window::Windows& windows = window_list_provider_->GetWindowList();
+ aura::Window::Windows::const_reverse_iterator iter =
+ std::find(windows.rbegin(), windows.rend(), window);
+ CHECK(iter != windows.rend());
+ ++iter;
+ aura::Window* behind = NULL;
+ if (iter != windows.rend())
+ behind = *iter++;
+
+ if (split_view_controller_->IsSplitViewModeActive()) {
+ aura::Window* left = split_view_controller_->left_window();
+ aura::Window* right = split_view_controller_->right_window();
+ CHECK(window == left || window == right);
+ if (behind == left || behind == right)
+ behind = (iter == windows.rend()) ? NULL : *iter;
+ }
+
+ return behind;
}
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|.
+ wm::ActivateWindow(window);
+ next_window->Show();
+ int dx = window->bounds().x() - next_window->bounds().x();
+ if (dx) {
+ gfx::Transform transform;
+ transform.Translate(dx, 0);
+ next_window->SetTransform(transform);
+ }
}
void WindowManagerImpl::OnTitleDragCompleted(aura::Window* window) {
aura::Window* next_window = GetWindowBehind(window);
- if (next_window)
+ if (!next_window)
+ return;
+ if (split_view_controller_->IsSplitViewModeActive())
+ split_view_controller_->ReplaceWindow(window, next_window);
+ else
OnSelectWindow(next_window);
+ wm::ActivateWindow(next_window);
}
void WindowManagerImpl::OnTitleDragCanceled(aura::Window* window) {
+ aura::Window* next_window = GetWindowBehind(window);
+ if (!next_window)
+ return;
+ next_window->SetTransform(gfx::Transform());
}
AthenaContainerLayoutManager::AthenaContainerLayoutManager() {
« no previous file with comments | « athena/wm/title_drag_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698