Index: ash/wm/window_cycle_controller.cc |
diff --git a/ash/wm/window_cycle_controller.cc b/ash/wm/window_cycle_controller.cc |
index f48ee76afa8f92f3d4aca34ba119b474c003141b..e991295d149f2582a1e40a741bc8801705b58ad3 100644 |
--- a/ash/wm/window_cycle_controller.cc |
+++ b/ash/wm/window_cycle_controller.cc |
@@ -128,24 +128,38 @@ void WindowCycleController::AltKeyReleased() { |
// static |
std::vector<aura::Window*> WindowCycleController::BuildWindowList() { |
WindowCycleList::WindowList windows; |
+ WindowCycleList::WindowList top_windows; |
Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
iter != root_windows.end(); ++iter) { |
if (*iter == Shell::GetActiveRootWindow()) |
continue; |
+ aura::Window* always_on_top_container = Shell::GetContainer( |
+ *iter, internal::kShellWindowId_AlwaysOnTopContainer); |
+ WindowCycleList::WindowList children = always_on_top_container->children(); |
+ top_windows.insert(top_windows.end(), children.begin(), children.end()); |
+ |
aura::Window* default_container = Shell::GetContainer( |
*iter, internal::kShellWindowId_DefaultContainer); |
- WindowCycleList::WindowList children = default_container->children(); |
+ children = default_container->children(); |
windows.insert(windows.end(), children.begin(), children.end()); |
} |
+ |
// Add windows in the active root windows last so that the topmost window |
// in the active root window becomes the front of the list. |
+ aura::Window* always_on_top_container = Shell::GetContainer( |
+ Shell::GetActiveRootWindow(), |
+ internal::kShellWindowId_AlwaysOnTopContainer); |
+ |
+ WindowCycleList::WindowList children = always_on_top_container->children(); |
+ top_windows.insert(top_windows.end(), children.begin(), children.end()); |
+ |
aura::Window* default_container = Shell::GetContainer( |
Shell::GetActiveRootWindow(), |
internal::kShellWindowId_DefaultContainer); |
- WindowCycleList::WindowList children = default_container->children(); |
+ children = default_container->children(); |
windows.insert(windows.end(), children.begin(), children.end()); |
// Removes unfocusable windows. |
@@ -155,8 +169,28 @@ std::vector<aura::Window*> WindowCycleController::BuildWindowList() { |
windows.end(), |
std::not1(std::ptr_fun(ash::wm::CanActivateWindow))); |
windows.erase(last, windows.end()); |
+ |
+ last = std::remove_if( |
+ top_windows.begin(), |
+ top_windows.end(), |
+ std::not1(std::ptr_fun(ash::wm::CanActivateWindow))); |
+ top_windows.erase(last, top_windows.end()); |
+ |
// Window cycling expects the topmost window at the front of the list. |
std::reverse(windows.begin(), windows.end()); |
+ |
+ // Always on top windows should be in the list after the active window. |
+ aura::Window* active_window = wm::GetActiveWindow(); |
+ WindowCycleList::WindowList::iterator active_location = |
+ std::find(windows.begin(), windows.end(), active_window); |
+ if (active_location == windows.end()) { |
+ // If there's no active window, insert at the beginning of the list. |
+ windows.insert(windows.begin(), top_windows.begin(), top_windows.end()); |
+ } else { |
+ active_location++; |
+ windows.insert(active_location, top_windows.begin(), top_windows.end()); |
Daniel Erat
2012/07/11 14:53:41
Is this putting always-on-top windows from other d
Daniel Erat
2012/07/13 14:07:12
Sorry, s/desktop/root window/g in this comment. A
oshima
2012/07/13 14:53:30
I agree with dan. I think that's what a user would
|
+ } |
+ |
return windows; |
} |