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

Unified Diff: ash/wm/window_cycle_controller.cc

Issue 10700057: Add always on top windows to the alt+tab list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698