diff options
-rw-r--r-- | ash/screen_ash.cc | 19 | ||||
-rw-r--r-- | ash/screen_ash.h | 8 | ||||
-rw-r--r-- | ash/shell.cc | 2 |
3 files changed, 15 insertions, 14 deletions
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc index ed83c46..c7d9cb9 100644 --- a/ash/screen_ash.cc +++ b/ash/screen_ash.cc @@ -21,8 +21,7 @@ aura::MonitorManager* GetMonitorManager() { } } // namespace -ScreenAsh::ScreenAsh(aura::RootWindow* root_window) - : root_window_(root_window) { +ScreenAsh::ScreenAsh() { } ScreenAsh::~ScreenAsh() { @@ -30,21 +29,29 @@ ScreenAsh::~ScreenAsh() { // static gfx::Rect ScreenAsh::GetMaximizedWindowBounds(aura::Window* window) { - return Shell::GetInstance()->shelf()->GetMaximizedWindowBounds(window); + if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) + return Shell::GetInstance()->shelf()->GetMaximizedWindowBounds(window); + else + return gfx::Screen::GetMonitorNearestWindow(window).bounds(); } // static gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaBounds(aura::Window* window) { - return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window); + if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) + return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window); + else + return gfx::Screen::GetMonitorNearestWindow(window).work_area(); } gfx::Point ScreenAsh::GetCursorScreenPoint() { - return root_window_->last_mouse_location(); + // TODO(oshima): Support multiple root window. + return Shell::GetPrimaryRootWindow()->last_mouse_location(); } gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() { const gfx::Point point = gfx::Screen::GetCursorScreenPoint(); - return root_window_->GetTopWindowContainingPoint(point); + // TODO(oshima): convert point to relateive to the root window. + return Shell::GetRootWindowAt(point)->GetTopWindowContainingPoint(point); } int ScreenAsh::GetNumMonitors() { diff --git a/ash/screen_ash.h b/ash/screen_ash.h index 1b2dbbc..7dd31fa 100644 --- a/ash/screen_ash.h +++ b/ash/screen_ash.h @@ -12,17 +12,13 @@ #include "ui/gfx/rect.h" #include "ui/gfx/screen_impl.h" -namespace aura { -class RootWindow; -} - namespace ash { // Aura implementation of gfx::Screen. Implemented here to avoid circular // dependencies. class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl { public: - explicit ScreenAsh(aura::RootWindow* root_window); + ScreenAsh(); virtual ~ScreenAsh(); // Returns the bounds for maximized windows. Maximized windows trigger @@ -44,8 +40,6 @@ class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl { virtual gfx::Monitor GetPrimaryMonitor() const OVERRIDE; private: - aura::RootWindow* root_window_; - DISALLOW_COPY_AND_ASSIGN(ScreenAsh); }; diff --git a/ash/shell.cc b/ash/shell.cc index 35f0850..51cd7bf 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -553,7 +553,7 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() { Shell::Shell(ShellDelegate* delegate) : root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()), - screen_(new ScreenAsh(root_window_.get())), + screen_(new ScreenAsh), env_filter_(NULL), delegate_(delegate), #if defined(OS_CHROMEOS) |