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

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: Add a test to verify functionality with multiple desktops Created 8 years, 5 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 | ash/wm/window_cycle_controller_unittest.cc » ('j') | 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..1aceb33f4cd99bfb85d1dd7a8503927ac0074a93 100644
--- a/ash/wm/window_cycle_controller.cc
+++ b/ash/wm/window_cycle_controller.cc
@@ -128,6 +128,7 @@ 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();
@@ -138,14 +139,27 @@ std::vector<aura::Window*> WindowCycleController::BuildWindowList() {
*iter, internal::kShellWindowId_DefaultContainer);
WindowCycleList::WindowList children = default_container->children();
windows.insert(windows.end(), children.begin(), children.end());
+
+ aura::Window* always_on_top_container = Shell::GetContainer(
sky 2012/07/17 17:43:37 Shouldn't always on top be added first?
Zachary Kuznia 2012/07/18 01:36:54 It's added last because the container is reversed
+ *iter, internal::kShellWindowId_AlwaysOnTopContainer);
sky 2012/07/17 17:43:37 Rather than this define an array of the ids of the
Zachary Kuznia 2012/07/18 01:36:54 top_windows is handled differently, because they n
+ children = always_on_top_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());
+ }
+
return windows;
}
« no previous file with comments | « no previous file | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698