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_ash.h" | 8 #include "ash/screen_ash.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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); | 173 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); |
174 | 174 |
175 // Scan the cycle list backwards to see which is the second topmost window | 175 // Scan the cycle list backwards to see which is the second topmost window |
176 // (and so on). Note that we might cycle a few indices twice if there is no | 176 // (and so on). Note that we might cycle a few indices twice if there is no |
177 // suitable window. However - since the list is fairly small this should be | 177 // suitable window. However - since the list is fairly small this should be |
178 // very fast anyways. | 178 // very fast anyways. |
179 aura::Window* found = NULL; | 179 aura::Window* found = NULL; |
180 for (int i = index + windows.size(); i >= 0; i--) { | 180 for (int i = index + windows.size(); i >= 0; i--) { |
181 aura::Window* window = windows[i % windows.size()]; | 181 aura::Window* window = windows[i % windows.size()]; |
182 if (window != exclude && | 182 if (window != exclude && window->type() == ui::wm::WINDOW_TYPE_NORMAL && |
183 window->type() == aura::client::WINDOW_TYPE_NORMAL && | 183 window->GetRootWindow() == root_window && window->TargetVisibility() && |
184 window->GetRootWindow() == root_window && | |
185 window->TargetVisibility() && | |
186 wm::GetWindowState(window)->window_position_managed()) { | 184 wm::GetWindowState(window)->window_position_managed()) { |
187 if (found && found != window) { | 185 if (found && found != window) { |
188 // no need to check !signle_window because the function must have | 186 // no need to check !signle_window because the function must have |
189 // been already returned in the "if (!single_window)" below. | 187 // been already returned in the "if (!single_window)" below. |
190 *single_window = false; | 188 *single_window = false; |
191 return found; | 189 return found; |
192 } | 190 } |
193 found = window; | 191 found = window; |
194 // If there is no need to check single window, return now. | 192 // If there is no need to check single window, return now. |
195 if (!single_window) | 193 if (!single_window) |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // If the alignment was pushing the window out of the screen, we ignore the | 536 // If the alignment was pushing the window out of the screen, we ignore the |
539 // alignment for that call. | 537 // alignment for that call. |
540 if (abs(pos.right() - work_area.right()) < grid) | 538 if (abs(pos.right() - work_area.right()) < grid) |
541 x = work_area.right() - w; | 539 x = work_area.right() - w; |
542 if (abs(pos.bottom() - work_area.bottom()) < grid) | 540 if (abs(pos.bottom() - work_area.bottom()) < grid) |
543 y = work_area.bottom() - h; | 541 y = work_area.bottom() - h; |
544 return gfx::Rect(x, y, w, h); | 542 return gfx::Rect(x, y, w, h); |
545 } | 543 } |
546 | 544 |
547 } // namespace ash | 545 } // namespace ash |
OLD | NEW |