summaryrefslogtreecommitdiffstats
path: root/ash/wm/overview
diff options
context:
space:
mode:
Diffstat (limited to 'ash/wm/overview')
-rw-r--r--ash/wm/overview/window_selector.cc2
-rw-r--r--ash/wm/overview/window_selector_controller.cc15
-rw-r--r--ash/wm/overview/window_selector_unittest.cc33
3 files changed, 49 insertions, 1 deletions
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc
index a7818f5..8015f77 100644
--- a/ash/wm/overview/window_selector.cc
+++ b/ash/wm/overview/window_selector.cc
@@ -347,11 +347,11 @@ void WindowSelector::Step(WindowSelector::Direction direction) {
}
void WindowSelector::SelectWindow() {
- ResetFocusRestoreWindow(false);
SelectWindow(windows_[selected_window_]->SelectionWindow());
}
void WindowSelector::SelectWindow(aura::Window* window) {
+ ResetFocusRestoreWindow(false);
if (showing_window_ && showing_window_->window() == window)
showing_window_->CancelRestore();
ScopedVector<WindowSelectorItem>::iterator iter =
diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc
index d56c463..e5ca77d 100644
--- a/ash/wm/overview/window_selector_controller.cc
+++ b/ash/wm/overview/window_selector_controller.cc
@@ -4,13 +4,16 @@
#include "ash/wm/overview/window_selector_controller.h"
+#include "ash/root_window_controller.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector.h"
+#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "base/metrics/histogram.h"
+#include "ui/aura/window.h"
namespace ash {
@@ -69,6 +72,18 @@ bool WindowSelectorController::IsSelecting() {
void WindowSelectorController::OnWindowSelected(aura::Window* window) {
window_selector_.reset();
+
+ // If there is a fullscreen window on this display and it was not selected
+ // it should exit fullscreen mode.
+ internal::RootWindowController* controller =
+ internal::GetRootWindowController(window->GetRootWindow());
+ aura::Window* fullscreen_window = NULL;
+ if (controller)
+ fullscreen_window = controller->GetTopmostFullscreenWindow();
+ if (fullscreen_window && fullscreen_window != window) {
+ wm::GetWindowState(fullscreen_window)->ToggleFullscreen();
+ }
+
wm::ActivateWindow(window);
last_selection_time_ = base::Time::Now();
}
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index 38916fd..29c8cc7 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -259,6 +259,39 @@ TEST_F(WindowSelectorTest, Basic) {
EXPECT_FALSE(aura::client::GetCursorClient(root_window)->IsCursorLocked());
}
+// Tests entering overview mode with two windows and selecting one.
+TEST_F(WindowSelectorTest, FullscreenWindow) {
+ gfx::Rect bounds(0, 0, 400, 400);
+ scoped_ptr<aura::Window> window1(CreateWindow(bounds));
+ scoped_ptr<aura::Window> window2(CreateWindow(bounds));
+ scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds));
+ wm::ActivateWindow(window1.get());
+
+ wm::GetWindowState(window1.get())->ToggleFullscreen();
+ // The panel is hidden in fullscreen mode.
+ EXPECT_FALSE(panel1->IsVisible());
+ EXPECT_TRUE(wm::GetWindowState(window1.get())->IsFullscreen());
+
+ // Enter overview and select the fullscreen window.
+ ToggleOverview();
+
+ // The panel becomes temporarily visible for the overview.
+ EXPECT_TRUE(panel1->IsVisible());
+ ClickWindow(window1.get());
+
+ // The window is still fullscreen as it was selected. The panel should again
+ // be hidden.
+ EXPECT_TRUE(wm::GetWindowState(window1.get())->IsFullscreen());
+ EXPECT_FALSE(panel1->IsVisible());
+
+ // Entering overview and selecting another window should exit fullscreen.
+ // TODO(flackr): Currently the panel remains hidden, but should become visible
+ // again.
+ ToggleOverview();
+ ClickWindow(window2.get());
+ EXPECT_FALSE(wm::GetWindowState(window1.get())->IsFullscreen());
+}
+
// Tests that the shelf dimming state is removed while in overview and restored
// on exiting overview.
TEST_F(WindowSelectorTest, OverviewUndimsShelf) {