OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/window_positioner.h" | 5 #include "ash/wm/window_positioner.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 // Process the window list and check if we can bail immediately. | 457 // Process the window list and check if we can bail immediately. |
458 for (size_t i = 0; i < windows.size(); i++) { | 458 for (size_t i = 0; i < windows.size(); i++) { |
459 // We only include opaque and visible windows. | 459 // We only include opaque and visible windows. |
460 if (windows[i] && windows[i]->IsVisible() && windows[i]->layer() && | 460 if (windows[i] && windows[i]->IsVisible() && windows[i]->layer() && |
461 (!windows[i]->transparent() || | 461 (!windows[i]->transparent() || |
462 windows[i]->layer()->GetTargetOpacity() == 1.0)) { | 462 windows[i]->layer()->GetTargetOpacity() == 1.0)) { |
463 wm::WindowState* window_state = wm::GetWindowState(windows[i]); | 463 wm::WindowState* window_state = wm::GetWindowState(windows[i]); |
464 // When any window is maximized we cannot find any free space. | 464 // When any window is maximized we cannot find any free space. |
465 if (window_state->IsMaximizedOrFullscreen()) | 465 if (window_state->IsMaximizedOrFullscreen()) |
466 return gfx::Rect(0, 0, 0, 0); | 466 return gfx::Rect(0, 0, 0, 0); |
467 if (window_state->IsNormalShowState()) | 467 if (window_state->IsNormalOrSnapped()) |
468 regions.push_back(&windows[i]->bounds()); | 468 regions.push_back(&windows[i]->bounds()); |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 if (regions.empty()) | 472 if (regions.empty()) |
473 return gfx::Rect(0, 0, 0, 0); | 473 return gfx::Rect(0, 0, 0, 0); |
474 | 474 |
475 int w = old_pos.width(); | 475 int w = old_pos.width(); |
476 int h = old_pos.height(); | 476 int h = old_pos.height(); |
477 int x_end = work_area.width() / 2; | 477 int x_end = work_area.width() / 2; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 // If the alignment was pushing the window out of the screen, we ignore the | 529 // If the alignment was pushing the window out of the screen, we ignore the |
530 // alignment for that call. | 530 // alignment for that call. |
531 if (abs(pos.right() - work_area.right()) < grid) | 531 if (abs(pos.right() - work_area.right()) < grid) |
532 x = work_area.right() - w; | 532 x = work_area.right() - w; |
533 if (abs(pos.bottom() - work_area.bottom()) < grid) | 533 if (abs(pos.bottom() - work_area.bottom()) < grid) |
534 y = work_area.bottom() - h; | 534 y = work_area.bottom() - h; |
535 return gfx::Rect(x, y, w, h); | 535 return gfx::Rect(x, y, w, h); |
536 } | 536 } |
537 | 537 |
538 } // namespace ash | 538 } // namespace ash |
OLD | NEW |