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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « athena/wm/title_drag_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/wm/public/window_manager.h" 5 #include "athena/wm/public/window_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "athena/common/container_priorities.h" 9 #include "athena/common/container_priorities.h"
10 #include "athena/input/public/accelerator_manager.h" 10 #include "athena/input/public/accelerator_manager.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const ui::Accelerator& accelerator) { 240 const ui::Accelerator& accelerator) {
241 switch (command_id) { 241 switch (command_id) {
242 case CMD_TOGGLE_OVERVIEW: 242 case CMD_TOGGLE_OVERVIEW:
243 ToggleOverview(); 243 ToggleOverview();
244 break; 244 break;
245 } 245 }
246 return true; 246 return true;
247 } 247 }
248 248
249 aura::Window* WindowManagerImpl::GetWindowBehind(aura::Window* window) { 249 aura::Window* WindowManagerImpl::GetWindowBehind(aura::Window* window) {
250 const aura::Window::Windows& windows = container_->children(); 250 const aura::Window::Windows& windows = window_list_provider_->GetWindowList();
251 aura::Window::Windows::const_iterator iter = 251 aura::Window::Windows::const_reverse_iterator iter =
252 std::find(windows.begin(), windows.end(), window); 252 std::find(windows.rbegin(), windows.rend(), window);
253 CHECK(iter != windows.end()); 253 CHECK(iter != windows.rend());
254 return (iter == windows.begin()) ? NULL : *(iter - 1); 254 ++iter;
255 aura::Window* behind = NULL;
256 if (iter != windows.rend())
257 behind = *iter++;
258
259 if (split_view_controller_->IsSplitViewModeActive()) {
260 aura::Window* left = split_view_controller_->left_window();
261 aura::Window* right = split_view_controller_->right_window();
262 CHECK(window == left || window == right);
263 if (behind == left || behind == right)
264 behind = (iter == windows.rend()) ? NULL : *iter;
265 }
266
267 return behind;
255 } 268 }
256 269
257 void WindowManagerImpl::OnTitleDragStarted(aura::Window* window) { 270 void WindowManagerImpl::OnTitleDragStarted(aura::Window* window) {
271 aura::Window* next_window = GetWindowBehind(window);
272 if (!next_window)
273 return;
274 // Make sure |window| is active. Also make sure that |next_window| is visible,
275 // and positioned to match the top-left edge of |window|.
276 wm::ActivateWindow(window);
277 next_window->Show();
278 int dx = window->bounds().x() - next_window->bounds().x();
279 if (dx) {
280 gfx::Transform transform;
281 transform.Translate(dx, 0);
282 next_window->SetTransform(transform);
283 }
258 } 284 }
259 285
260 void WindowManagerImpl::OnTitleDragCompleted(aura::Window* window) { 286 void WindowManagerImpl::OnTitleDragCompleted(aura::Window* window) {
261 aura::Window* next_window = GetWindowBehind(window); 287 aura::Window* next_window = GetWindowBehind(window);
262 if (next_window) 288 if (!next_window)
289 return;
290 if (split_view_controller_->IsSplitViewModeActive())
291 split_view_controller_->ReplaceWindow(window, next_window);
292 else
263 OnSelectWindow(next_window); 293 OnSelectWindow(next_window);
294 wm::ActivateWindow(next_window);
264 } 295 }
265 296
266 void WindowManagerImpl::OnTitleDragCanceled(aura::Window* window) { 297 void WindowManagerImpl::OnTitleDragCanceled(aura::Window* window) {
298 aura::Window* next_window = GetWindowBehind(window);
299 if (!next_window)
300 return;
301 next_window->SetTransform(gfx::Transform());
267 } 302 }
268 303
269 AthenaContainerLayoutManager::AthenaContainerLayoutManager() { 304 AthenaContainerLayoutManager::AthenaContainerLayoutManager() {
270 } 305 }
271 306
272 AthenaContainerLayoutManager::~AthenaContainerLayoutManager() { 307 AthenaContainerLayoutManager::~AthenaContainerLayoutManager() {
273 } 308 }
274 309
275 void AthenaContainerLayoutManager::OnWindowResized() { 310 void AthenaContainerLayoutManager::OnWindowResized() {
276 instance->Layout(); 311 instance->Layout();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 DCHECK(!instance); 354 DCHECK(!instance);
320 } 355 }
321 356
322 // static 357 // static
323 WindowManager* WindowManager::GetInstance() { 358 WindowManager* WindowManager::GetInstance() {
324 DCHECK(instance); 359 DCHECK(instance);
325 return instance; 360 return instance;
326 } 361 }
327 362
328 } // namespace athena 363 } // namespace athena
OLDNEW
« 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