summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/ash_switches.cc3
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/display/display_controller.cc21
-rw-r--r--ash/display/display_controller.h5
-rw-r--r--ash/display/display_controller_unittest.cc14
-rw-r--r--ash/display/multi_display_manager.cc7
-rw-r--r--ash/display/multi_display_manager_unittest.cc20
-rw-r--r--ash/display/screen_position_controller.cc6
-rw-r--r--ash/extended_desktop_unittest.cc129
-rw-r--r--ash/root_window_controller.cc9
-rw-r--r--ash/root_window_controller_unittest.cc10
-rw-r--r--ash/screen_ash_unittest.cc6
-rw-r--r--ash/shell.cc2
-rw-r--r--ash/shell.h2
-rw-r--r--ash/shell_context_menu.cc5
-rw-r--r--ash/wm/stacking_controller.cc6
16 files changed, 111 insertions, 135 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 24c3e2e..1ddefda 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -22,9 +22,6 @@ const char kAshNotifyDisabled[] = "ash-notify-disabled";
// Enables the heads-up display for tracking touch points.
const char kAshTouchHud[] = "ash-touch-hud";
-// Enables virtual screen coordinate system.
-const char kAshVirtualScreenCoordinates[] = "ash-virtual-screen-coordinates";
-
// If present animations are disabled.
const char kAshWindowAnimationsDisabled[] = "ash-window-animations-disabled";
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index d8e5369..3ed3d90 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -20,7 +20,6 @@ ASH_EXPORT extern const char kAshEnableOak[];
ASH_EXPORT extern const char kAshExtendedDesktop[];
ASH_EXPORT extern const char kAshNotifyDisabled[];
ASH_EXPORT extern const char kAshTouchHud[];
-ASH_EXPORT extern const char kAshVirtualScreenCoordinates[];
ASH_EXPORT extern const char kAshWindowAnimationsDisabled[];
ASH_EXPORT extern const char kAuraGoogleDialogFrames[];
ASH_EXPORT extern const char kAuraLegacyPowerButton[];
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index d2e0ee5..b9c2d3a 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -22,10 +22,7 @@ namespace internal {
namespace {
// True if the extended desktop mode is enabled.
bool extended_desktop_enabled = false;
-
-// True if the virtual screen coordinates is enabled.
-bool virtual_screen_coordinates_enabled = false;
-}
+} // namespace
DisplayController::DisplayController()
: secondary_display_layout_(RIGHT) {
@@ -245,19 +242,6 @@ void DisplayController::SetExtendedDesktopEnabled(bool enabled) {
extended_desktop_enabled = enabled;
}
-// static
-bool DisplayController::IsVirtualScreenCoordinatesEnabled() {
- return IsExtendedDesktopEnabled() &&
- (virtual_screen_coordinates_enabled ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshVirtualScreenCoordinates));
-}
-
-// static
-void DisplayController::SetVirtualScreenCoordinatesEnabled(bool enabled) {
- virtual_screen_coordinates_enabled = enabled;
-}
-
aura::RootWindow* DisplayController::AddRootWindowForDisplay(
const gfx::Display& display) {
aura::RootWindow* root = aura::Env::GetInstance()->display_manager()->
@@ -276,8 +260,7 @@ aura::RootWindow* DisplayController::AddRootWindowForDisplay(
}
void DisplayController::UpdateDisplayBoundsForLayout() {
- if (!IsVirtualScreenCoordinatesEnabled() ||
- gfx::Screen::GetNumDisplays() <= 1) {
+ if (!IsExtendedDesktopEnabled() || gfx::Screen::GetNumDisplays() <= 1) {
return;
}
DCHECK_EQ(2, gfx::Screen::GetNumDisplays());
diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h
index 0eb021b..2e1d125 100644
--- a/ash/display/display_controller.h
+++ b/ash/display/display_controller.h
@@ -88,11 +88,6 @@ class ASH_EXPORT DisplayController : public aura::DisplayObserver {
// Change the extended desktop mode. Used for testing.
static void SetExtendedDesktopEnabled(bool enabled);
- // Is virtual screen coordinates enabled?
- static bool IsVirtualScreenCoordinatesEnabled();
- // Turns on/off the virtual screen coordinates.
- static void SetVirtualScreenCoordinatesEnabled(bool enabled);
-
private:
// Creates a root window for |display| and stores it in the |root_windows_|
// map.
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index cbb0104..48d2bab 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -36,14 +36,12 @@ class DisplayControllerTest : public test::AshTestBase {
virtual void SetUp() OVERRIDE {
internal::DisplayController::SetExtendedDesktopEnabled(true);
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
AshTestBase::SetUp();
}
virtual void TearDown() OVERRIDE {
AshTestBase::TearDown();
internal::DisplayController::SetExtendedDesktopEnabled(false);
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
private:
@@ -61,7 +59,7 @@ class DisplayControllerTest : public test::AshTestBase {
#endif
TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) {
- UpdateDisplay("0+0-500x500,0+0-400x400");
+ UpdateDisplay("500x500,400x400");
gfx::Display* secondary_display =
aura::Env::GetInstance()->display_manager()->GetDisplayAt(1);
gfx::Insets insets(5, 5, 5, 5);
@@ -97,7 +95,7 @@ TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) {
TEST_F(DisplayControllerTest, MAYBE_BoundsUpdated) {
Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
internal::DisplayController::BOTTOM);
- UpdateDisplay("0+0-500x500,0+0-400x400");
+ UpdateDisplay("500x500,400x400");
gfx::Display* secondary_display =
aura::Env::GetInstance()->display_manager()->GetDisplayAt(1);
gfx::Insets insets(5, 5, 5, 5);
@@ -107,21 +105,21 @@ TEST_F(DisplayControllerTest, MAYBE_BoundsUpdated) {
EXPECT_EQ("0,500 400x400", GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("5,505 390x390", GetSecondaryDisplay().work_area().ToString());
- UpdateDisplay("0+0-600x600,0+0-400x400");
+ UpdateDisplay("600x600,400x400");
EXPECT_EQ("0,0 600x600", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,600 400x400", GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("5,605 390x390", GetSecondaryDisplay().work_area().ToString());
- UpdateDisplay("0+0-600x600,0+0-500x500");
+ UpdateDisplay("600x600,500x500");
EXPECT_EQ("0,0 600x600", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,600 500x500", GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("5,605 490x490", GetSecondaryDisplay().work_area().ToString());
- UpdateDisplay("0+0-600x600");
+ UpdateDisplay("600x600");
EXPECT_EQ("0,0 600x600", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ(1, gfx::Screen::GetNumDisplays());
- UpdateDisplay("0+0-700x700,0+0-1000x1000");
+ UpdateDisplay("700x700,1000x1000");
ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
EXPECT_EQ("0,0 700x700", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,700 1000x1000", GetSecondaryDisplay().bounds().ToString());
diff --git a/ash/display/multi_display_manager.cc b/ash/display/multi_display_manager.cc
index 5098e0a..becb5f4 100644
--- a/ash/display/multi_display_manager.cc
+++ b/ash/display/multi_display_manager.cc
@@ -154,9 +154,8 @@ const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow(
const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint(
const gfx::Point& point) const {
- if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled())
+ if (!DisplayController::IsExtendedDesktopEnabled())
return displays_[0];
-
for (std::vector<gfx::Display>::const_iterator iter = displays_.begin();
iter != displays_.end(); ++iter) {
const gfx::Display& display = *iter;
@@ -170,7 +169,7 @@ const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint(
const gfx::Display& MultiDisplayManager::GetDisplayMatching(
const gfx::Rect& rect) const {
- if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled())
+ if (!DisplayController::IsExtendedDesktopEnabled())
return displays_[0];
if (rect.IsEmpty())
return GetDisplayNearestPoint(rect.origin());
@@ -276,7 +275,7 @@ gfx::Display& MultiDisplayManager::FindDisplayForRootWindow(
void MultiDisplayManager::AddDisplayFromSpec(const std::string& spec) {
gfx::Display display = CreateDisplayFromSpec(spec);
- if (internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) {
+ if (DisplayController::IsExtendedDesktopEnabled()) {
const gfx::Insets insets = display.GetWorkAreaInsets();
const gfx::Rect& native_bounds = display.bounds_in_pixel();
display.set_bounds(
diff --git a/ash/display/multi_display_manager_unittest.cc b/ash/display/multi_display_manager_unittest.cc
index d53ec01..2e9deaa 100644
--- a/ash/display/multi_display_manager_unittest.cc
+++ b/ash/display/multi_display_manager_unittest.cc
@@ -4,6 +4,7 @@
#include "ash/display/multi_display_manager.h"
+#include "ash/display/display_controller.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/format_macros.h"
@@ -31,6 +32,7 @@ class MultiDisplayManagerTest : public test::AshTestBase,
virtual ~MultiDisplayManagerTest() {}
virtual void SetUp() OVERRIDE {
+ internal::DisplayController::SetExtendedDesktopEnabled(true);
AshTestBase::SetUp();
display_manager()->AddObserver(this);
Shell::GetPrimaryRootWindow()->AddObserver(this);
@@ -39,6 +41,7 @@ class MultiDisplayManagerTest : public test::AshTestBase,
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
display_manager()->RemoveObserver(this);
AshTestBase::TearDown();
+ internal::DisplayController::SetExtendedDesktopEnabled(false);
}
aura::DisplayManager* display_manager() {
@@ -112,7 +115,8 @@ TEST_F(MultiDisplayManagerTest, MAYBE_NativeDisplayTest) {
EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id());
EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString());
- EXPECT_EQ("0,0 400x400", added()[0].bounds().ToString());
+ // Secondary display is on right.
+ EXPECT_EQ("500,0 400x400", added()[0].bounds().ToString());
EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString());
reset();
@@ -134,7 +138,8 @@ TEST_F(MultiDisplayManagerTest, MAYBE_NativeDisplayTest) {
EXPECT_EQ(2U, display_manager()->GetNumDisplays());
EXPECT_EQ("0 1 0", GetCountSummary());
EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id());
- EXPECT_EQ("0,0 600x400", added()[0].bounds().ToString());
+ // Secondary display is on right.
+ EXPECT_EQ("1000,0 600x400", added()[0].bounds().ToString());
EXPECT_EQ("1001,0 600x400", added()[0].bounds_in_pixel().ToString());
reset();
@@ -173,13 +178,14 @@ TEST_F(MultiDisplayManagerTest, MAYBE_NativeDisplayTest) {
reset();
// Add secondary.
- UpdateDisplay("0+0-1000x600,1000+0-600x400");
+ UpdateDisplay("0+0-1000x600,1000+1000-600x400");
EXPECT_EQ(2U, display_manager()->GetNumDisplays());
EXPECT_EQ("0,0 1000x600",
display_manager()->GetDisplayAt(0)->bounds().ToString());
- EXPECT_EQ("0,0 600x400",
- display_manager()->GetDisplayAt(1)->bounds().ToString());
+ // Secondary display is on right.
EXPECT_EQ("1000,0 600x400",
+ display_manager()->GetDisplayAt(1)->bounds().ToString());
+ EXPECT_EQ("1000,1000 600x400",
display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString());
reset();
@@ -230,12 +236,12 @@ TEST_F(MultiDisplayManagerTest, MAYBE_EmulatorTest) {
TEST_F(MultiDisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) {
aura::DisplayManager::set_use_fullscreen_host_window(true);
- UpdateDisplay("0+0-1000x600");
+ UpdateDisplay("1000x600");
EXPECT_EQ(1,
Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor());
EXPECT_EQ("1000x600",
Shell::GetPrimaryRootWindow()->bounds().size().ToString());
- UpdateDisplay("0+0-1000x600*2");
+ UpdateDisplay("1000x600*2");
EXPECT_EQ(2,
Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor());
EXPECT_EQ("500x300",
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc
index 80091ef..93794ac 100644
--- a/ash/display/screen_position_controller.cc
+++ b/ash/display/screen_position_controller.cc
@@ -56,7 +56,7 @@ void ScreenPositionController::ConvertPointToScreen(
gfx::Point* point) {
const aura::RootWindow* root = window->GetRootWindow();
aura::Window::ConvertPointToWindow(window, root, point);
- if (DisplayController::IsVirtualScreenCoordinatesEnabled()) {
+ if (DisplayController::IsExtendedDesktopEnabled()) {
const gfx::Point display_origin =
gfx::Screen::GetDisplayNearestWindow(
const_cast<aura::RootWindow*>(root)).bounds().origin();
@@ -68,7 +68,7 @@ void ScreenPositionController::ConvertPointFromScreen(
const aura::Window* window,
gfx::Point* point) {
const aura::RootWindow* root = window->GetRootWindow();
- if (DisplayController::IsVirtualScreenCoordinatesEnabled()) {
+ if (DisplayController::IsExtendedDesktopEnabled()) {
const gfx::Point display_origin =
gfx::Screen::GetDisplayNearestWindow(
const_cast<aura::RootWindow*>(root)).bounds().origin();
@@ -80,7 +80,7 @@ void ScreenPositionController::ConvertPointFromScreen(
void ScreenPositionController::SetBounds(
aura::Window* window,
const gfx::Rect& bounds) {
- if (!DisplayController::IsVirtualScreenCoordinatesEnabled() ||
+ if (!DisplayController::IsExtendedDesktopEnabled() ||
!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) {
window->SetBounds(bounds);
return;
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc
index 179055e..0b0d554 100644
--- a/ash/extended_desktop_unittest.cc
+++ b/ash/extended_desktop_unittest.cc
@@ -88,7 +88,7 @@ class ExtendedDesktopTest : public test::AshTestBase {
// Test conditions that root windows in extended desktop mode
// must satisfy.
TEST_F(ExtendedDesktopTest, Basic) {
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
// All root windows must have the root window controller.
@@ -107,55 +107,49 @@ TEST_F(ExtendedDesktopTest, Basic) {
}
TEST_F(ExtendedDesktopTest, Activation) {
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- // Move the active root window to the secondary.
- Shell::GetInstance()->set_active_root_window(root_windows[1]);
-
- views::Widget* widget_on_2nd = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
- EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow());
-
- // Move the active root window back to the primary.
- Shell::GetInstance()->set_active_root_window(root_windows[0]);
-
views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
+ views::Widget* widget_on_2nd =
+ CreateTestWidget(gfx::Rect(1200, 10, 100, 100));
EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow());
-
- aura::test::EventGenerator generator_1st(root_windows[0]);
- aura::test::EventGenerator generator_2nd(root_windows[1]);
-
- // Clicking a window changes the active window and active root window.
- generator_2nd.MoveMouseToCenterOf(widget_on_2nd->GetNativeView());
- generator_2nd.ClickLeftButton();
+ EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow());
EXPECT_EQ(widget_on_2nd->GetNativeView(),
root_windows[0]->GetFocusManager()->GetFocusedWindow());
EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView()));
+ aura::test::EventGenerator generator_1st(root_windows[0]);
+ aura::test::EventGenerator generator_2nd(root_windows[1]);
+
+ // Clicking a window changes the active window and active root window.
generator_1st.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
generator_1st.ClickLeftButton();
EXPECT_EQ(widget_on_1st->GetNativeView(),
root_windows[0]->GetFocusManager()->GetFocusedWindow());
EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
+
+ generator_2nd.MoveMouseToCenterOf(widget_on_2nd->GetNativeView());
+ generator_2nd.ClickLeftButton();
+
+ EXPECT_EQ(widget_on_2nd->GetNativeView(),
+ root_windows[0]->GetFocusManager()->GetFocusedWindow());
+ EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView()));
}
TEST_F(ExtendedDesktopTest, SystemModal) {
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- Shell::GetInstance()->set_active_root_window(root_windows[0]);
views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow());
- // Change the active root window to 2nd.
- Shell::GetInstance()->set_active_root_window(root_windows[1]);
-
// Open system modal. Make sure it's on 2nd root window and active.
- views::Widget* modal_widget = views::Widget::CreateWindowWithParent(
- new ModalWidgetDelegate(), NULL);
+ views::Widget* modal_widget = views::Widget::CreateWindowWithBounds(
+ new ModalWidgetDelegate(), gfx::Rect(1200, 100, 100, 100));
modal_widget->Show();
EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow());
@@ -177,7 +171,7 @@ TEST_F(ExtendedDesktopTest, SystemModal) {
}
TEST_F(ExtendedDesktopTest, TestCursor) {
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::GetInstance()->ShowCursor(false);
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
EXPECT_FALSE(root_windows[0]->cursor_shown());
@@ -194,8 +188,7 @@ TEST_F(ExtendedDesktopTest, TestCursor) {
}
TEST_F(ExtendedDesktopTest, CycleWindows) {
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
- UpdateDisplay("0+0-700x500,0+0-500x500");
+ UpdateDisplay("700x500,500x500");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
WindowCycleController* controller =
@@ -240,12 +233,10 @@ TEST_F(ExtendedDesktopTest, CycleWindows) {
EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView()));
controller->HandleCycleWindow(WindowCycleController::BACKWARD, true);
EXPECT_TRUE(wm::IsActiveWindow(d2_w2->GetNativeView()));
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
TEST_F(ExtendedDesktopTest, GetRootWindowAt) {
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
- UpdateDisplay("0+0-700x500,0+0-500x500");
+ UpdateDisplay("700x500,500x500");
Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
internal::DisplayController::LEFT);
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
@@ -261,12 +252,10 @@ TEST_F(ExtendedDesktopTest, GetRootWindowAt) {
// Out of range point should return the primary root window
EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(-600, 0)));
EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(701, 100)));
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
TEST_F(ExtendedDesktopTest, GetRootWindowMatching) {
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
- UpdateDisplay("0+0-700x500,0+0-500x500");
+ UpdateDisplay("700x500,500x500");
Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
internal::DisplayController::LEFT);
@@ -301,11 +290,10 @@ TEST_F(ExtendedDesktopTest, GetRootWindowMatching) {
Shell::GetRootWindowMatching(gfx::Rect(-600, -300, 50, 50)));
EXPECT_EQ(root_windows[0],
Shell::GetRootWindowMatching(gfx::Rect(0, 1000, 50, 50)));
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
TEST_F(ExtendedDesktopTest, Capture) {
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
aura::test::EventCountDelegate r1_d1;
@@ -318,6 +306,7 @@ TEST_F(ExtendedDesktopTest, Capture) {
&r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0]));
scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate(
&r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1]));
+
r1_w1->SetCapture();
EXPECT_EQ(r1_w1.get(),
@@ -327,8 +316,12 @@ TEST_F(ExtendedDesktopTest, Capture) {
generator2.ClickLeftButton();
EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset());
EXPECT_EQ("0 0", r2_d1.GetMouseButtonCountsAndReset());
- EXPECT_EQ("1 1 0", r1_d1.GetMouseMotionCountsAndReset());
+ // The mouse is outside, so no move event will be sent.
+ EXPECT_EQ("1 0 0", r1_d1.GetMouseMotionCountsAndReset());
EXPECT_EQ("1 1", r1_d1.GetMouseButtonCountsAndReset());
+ // (15,15) on 1st display is (-985,15) on 2nd display.
+ generator2.MoveMouseTo(-985, 15);
+ EXPECT_EQ("0 1 0", r1_d1.GetMouseMotionCountsAndReset());
r1_w2->SetCapture();
EXPECT_EQ(r1_w2.get(),
@@ -344,7 +337,7 @@ TEST_F(ExtendedDesktopTest, Capture) {
r1_w2->ReleaseCapture();
EXPECT_EQ(NULL,
aura::client::GetCaptureWindow(r2_w1->GetRootWindow()));
- generator2.MoveMouseBy(-10, -10);
+ generator2.MoveMouseTo(15, 15);
generator2.ClickLeftButton();
EXPECT_EQ("1 1 0", r2_d1.GetMouseMotionCountsAndReset());
EXPECT_EQ("1 1", r2_d1.GetMouseButtonCountsAndReset());
@@ -354,8 +347,7 @@ TEST_F(ExtendedDesktopTest, Capture) {
}
TEST_F(ExtendedDesktopTest, MoveWindow) {
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
@@ -384,13 +376,10 @@ TEST_F(ExtendedDesktopTest, MoveWindow) {
// TODO(oshima): This one probably should pick the closest root window.
d1->SetBounds(gfx::Rect(200, 10, 100, 100));
EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
-
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) {
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
views::Widget* w1_t1 = CreateTestWidgetWithParent(
@@ -442,49 +431,67 @@ TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) {
EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow());
EXPECT_EQ("10,50 50x50",
w1_t1->GetWindowBoundsInScreen().ToString());
-
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
namespace internal {
// Test if the Window::ConvertPointToWindow works across root windows.
// TODO(oshima): Move multiple display suport and this test to aura.
TEST_F(ExtendedDesktopTest, ConvertPoint) {
- UpdateDisplay("0+0-1000x600,1001+0-600x400");
+ UpdateDisplay("1000x600,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
gfx::Display& display_1 =
display_manager()->FindDisplayForRootWindow(root_windows[0]);
EXPECT_EQ("0,0", display_1.bounds().origin().ToString());
gfx::Display& display_2 =
display_manager()->FindDisplayForRootWindow(root_windows[1]);
- Shell::GetInstance()->set_active_root_window(root_windows[0]);
+ EXPECT_EQ("1000,0", display_2.bounds().origin().ToString());
+
aura::Window* d1 =
CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView();
- Shell::GetInstance()->set_active_root_window(root_windows[1]);
aura::Window* d2 =
- CreateTestWidget(gfx::Rect(20, 20, 100, 100))->GetNativeView();
-
- // TODO(oshima):
- // This is a hack to emulate virtual screen coordinates. Cleanup this
- // when the virtual screen coordinates is implemented.a
- gfx::Rect bounds = display_2.bounds();
- bounds.set_origin(gfx::Point(500, 500));
- display_2.set_bounds(bounds);
+ CreateTestWidget(gfx::Rect(1020, 20, 100, 100))->GetNativeView();
+ EXPECT_EQ(root_windows[0], d1->GetRootWindow());
+ EXPECT_EQ(root_windows[1], d2->GetRootWindow());
+
// Convert point in the Root2's window to the Root1's window Coord.
gfx::Point p(0, 0);
aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p);
- EXPECT_EQ("500,500", p.ToString());
+ EXPECT_EQ("1000,0", p.ToString());
p.SetPoint(0, 0);
aura::Window::ConvertPointToWindow(d2, d1, &p);
- EXPECT_EQ("510,510", p.ToString());
+ EXPECT_EQ("1010,10", p.ToString());
// Convert point in the Root1's window to the Root2's window Coord.
p.SetPoint(0, 0);
aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p);
- EXPECT_EQ("-500,-500", p.ToString());
+ EXPECT_EQ("-1000,0", p.ToString());
p.SetPoint(0, 0);
aura::Window::ConvertPointToWindow(d1, d2, &p);
- EXPECT_EQ("-510,-510", p.ToString());
+ EXPECT_EQ("-1010,-10", p.ToString());
+
+ // Move the 2nd display to the bottom and test again.
+ Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
+ internal::DisplayController::BOTTOM);
+
+ display_2 = display_manager()->FindDisplayForRootWindow(root_windows[1]);
+ EXPECT_EQ("0,600", display_2.bounds().origin().ToString());
+
+ // Convert point in Root2's window to Root1's window Coord.
+ p.SetPoint(0, 0);
+ aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p);
+ EXPECT_EQ("0,600", p.ToString());
+ p.SetPoint(0, 0);
+ aura::Window::ConvertPointToWindow(d2, d1, &p);
+ EXPECT_EQ("10,610", p.ToString());
+
+ // Convert point in Root1's window to Root2's window Coord.
+ p.SetPoint(0, 0);
+ aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p);
+ EXPECT_EQ("0,-600", p.ToString());
+ p.SetPoint(0, 0);
+ aura::Window::ConvertPointToWindow(d1, d2, &p);
+ EXPECT_EQ("-10,-610", p.ToString());
}
+
} // namespace internal
} // namespace ash
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index ef046bd..f2abcc5 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -74,9 +74,7 @@ void MoveAllWindows(aura::RootWindow* src,
continue;
// Update the restore bounds to make it relative to the display.
- gfx::Rect restore_bounds;
- if (internal::DisplayController::IsVirtualScreenCoordinatesEnabled())
- restore_bounds = GetRestoreBoundsInParent(window);
+ gfx::Rect restore_bounds(GetRestoreBoundsInParent(window));
dst_container->AddChild(window);
if (!restore_bounds.IsEmpty())
SetRestoreBoundsInParent(window, restore_bounds);
@@ -240,6 +238,11 @@ RootWindowController::RootWindowController(aura::RootWindow* root_window)
}
RootWindowController::~RootWindowController() {
+ if (Shell::GetActiveRootWindow() == root_window_.get()) {
+ Shell::GetInstance()->set_active_root_window(
+ Shell::GetPrimaryRootWindow() == root_window_.get() ?
+ NULL : Shell::GetPrimaryRootWindow());
+ }
SetRootWindowController(root_window_.get(), NULL);
event_client_.reset();
screen_dimmer_.reset();
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index d31e30b..1f50afd 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -68,14 +68,12 @@ class RootWindowControllerTest : public test::AshTestBase {
virtual void SetUp() OVERRIDE {
internal::DisplayController::SetExtendedDesktopEnabled(true);
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
AshTestBase::SetUp();
}
virtual void TearDown() OVERRIDE {
AshTestBase::TearDown();
internal::DisplayController::SetExtendedDesktopEnabled(false);
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
private:
@@ -83,7 +81,7 @@ class RootWindowControllerTest : public test::AshTestBase {
};
TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
- UpdateDisplay("0+0-600x600,600+0-500x500");
+ UpdateDisplay("600x600,500x500");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100));
@@ -119,7 +117,7 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString());
#endif
- UpdateDisplay("0+0-600x600");
+ UpdateDisplay("600x600");
EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow());
EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString());
@@ -159,7 +157,7 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
}
TEST_F(RootWindowControllerTest, MoveWindows_Modal) {
- UpdateDisplay("0+0-500x500,500+0-500x500");
+ UpdateDisplay("500x500,500x500");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
// Emulate virtual screen coordinate system.
@@ -180,7 +178,7 @@ TEST_F(RootWindowControllerTest, MoveWindows_Modal) {
generator_1st.ClickLeftButton();
EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
- UpdateDisplay("0+0-500x500");
+ UpdateDisplay("500x500");
EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow());
EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
generator_1st.ClickLeftButton();
diff --git a/ash/screen_ash_unittest.cc b/ash/screen_ash_unittest.cc
index 5197e38..6bb3b72 100644
--- a/ash/screen_ash_unittest.cc
+++ b/ash/screen_ash_unittest.cc
@@ -23,14 +23,12 @@ class ScreenAshTest : public test::AshTestBase {
virtual void SetUp() OVERRIDE {
internal::DisplayController::SetExtendedDesktopEnabled(true);
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
AshTestBase::SetUp();
}
virtual void TearDown() OVERRIDE {
AshTestBase::TearDown();
internal::DisplayController::SetExtendedDesktopEnabled(false);
- internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
private:
@@ -39,7 +37,7 @@ class ScreenAshTest : public test::AshTestBase {
#if !defined(OS_WIN)
TEST_F(ScreenAshTest, Bounds) {
- UpdateDisplay("0+0-600x600,600+0-500x500");
+ UpdateDisplay("600x600,500x500");
views::Widget* primary =
views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100));
@@ -83,7 +81,7 @@ TEST_F(ScreenAshTest, Bounds) {
#endif
TEST_F(ScreenAshTest, ConvertRect) {
- UpdateDisplay("0+0-600x600,600+0-500x500");
+ UpdateDisplay("600x600,500x500");
views::Widget* primary =
views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100));
diff --git a/ash/shell.cc b/ash/shell.cc
index 630d44e..223438a 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -363,8 +363,6 @@ std::vector<aura::Window*> Shell::GetAllContainers(int container_id) {
}
void Shell::Init() {
- if (internal::DisplayController::IsVirtualScreenCoordinatesEnabled())
- VLOG(1) << "Using virtual screen coordinates";
// Install the custom factory first so that views::FocusManagers for Tray,
// Launcher, and WallPaper could be created by the factory.
views::FocusManagerFactory::Install(new AshFocusManagerFactory);
diff --git a/ash/shell.h b/ash/shell.h
index c074ffc..1361465 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -395,7 +395,7 @@ class ASH_EXPORT Shell : aura::CursorDelegate {
ScreenAsh* screen_;
- // Active root window. Never become NULL.
+ // Active root window. Never becomes NULL during the session.
aura::RootWindow* active_root_window_;
// The CompoundEventFilter owned by aura::Env object.
diff --git a/ash/shell_context_menu.cc b/ash/shell_context_menu.cc
index 7cf6f86..e704147 100644
--- a/ash/shell_context_menu.cc
+++ b/ash/shell_context_menu.cc
@@ -25,11 +25,6 @@ ShellContextMenu::~ShellContextMenu() {
void ShellContextMenu::ShowMenu(views::Widget* widget,
const gfx::Point& location) {
- if (!internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) {
- Shell::GetInstance()->set_active_root_window(
- widget->GetNativeView()->GetRootWindow());
- }
-
ui::SimpleMenuModel menu_model(this);
menu_model.AddItem(MENU_CHANGE_WALLPAPER,
l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER));
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 71c3bde..452be23 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -23,9 +23,9 @@ namespace {
// that matches the window's bound will be used. Otherwise, it'll
// return the active root window.
aura::RootWindow* FindContainerRoot(const gfx::Rect& bounds) {
- if (!DisplayController::IsVirtualScreenCoordinatesEnabled() ||
- (bounds.origin().x() == 0 && bounds.origin().y() == 0
- && bounds.IsEmpty())) {
+ if (!DisplayController::IsExtendedDesktopEnabled() ||
+ (bounds.origin().x() == 0 && bounds.origin().y() == 0 &&
+ bounds.IsEmpty())) {
return Shell::GetActiveRootWindow();
}
return Shell::GetRootWindowMatching(bounds);