diff options
-rw-r--r-- | athena/screen/screen_manager_impl.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/athena/screen/screen_manager_impl.cc b/athena/screen/screen_manager_impl.cc index e426a80..6ea40ae 100644 --- a/athena/screen/screen_manager_impl.cc +++ b/athena/screen/screen_manager_impl.cc @@ -9,9 +9,11 @@ #include "athena/screen/screen_accelerator_handler.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "ui/aura/client/screen_position_client.h" #include "ui/aura/client/window_tree_client.h" #include "ui/aura/layout_manager.h" #include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" #include "ui/wm/core/capture_controller.h" namespace athena { @@ -76,6 +78,42 @@ class AthenaWindowTreeClient : public aura::client::WindowTreeClient { DISALLOW_COPY_AND_ASSIGN(AthenaWindowTreeClient); }; +class AthenaScreenPositionClient : public aura::client::ScreenPositionClient { + public: + AthenaScreenPositionClient() { + } + virtual ~AthenaScreenPositionClient() { + } + + private: + // aura::client::ScreenPositionClient: + virtual void ConvertPointToScreen(const aura::Window* window, + gfx::Point* point) OVERRIDE { + const aura::Window* root = window->GetRootWindow(); + aura::Window::ConvertPointToTarget(window, root, point); + } + + virtual void ConvertPointFromScreen(const aura::Window* window, + gfx::Point* point) OVERRIDE { + const aura::Window* root = window->GetRootWindow(); + aura::Window::ConvertPointToTarget(root, window, point); + } + + virtual void ConvertHostPointToScreen(aura::Window* window, + gfx::Point* point) OVERRIDE { + // TODO(oshima): Implement this when adding multiple display support. + NOTREACHED(); + } + + virtual void SetBounds(aura::Window* window, + const gfx::Rect& bounds, + const gfx::Display& display) OVERRIDE { + window->SetBounds(bounds); + } + + DISALLOW_COPY_AND_ASSIGN(AthenaScreenPositionClient); +}; + aura::Window* CreateContainerInternal(aura::Window* parent, const std::string& name) { aura::Window* container = new aura::Window(NULL); @@ -108,6 +146,7 @@ class ScreenManagerImpl : public ScreenManager { scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; scoped_ptr<AcceleratorHandler> accelerator_handler_; scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; + scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl); }; @@ -129,6 +168,11 @@ aura::Window* ScreenManagerImpl::CreateDefaultContainer( aura::Window* container = CreateContainerInternal(root_window_, name); window_tree_client_.reset(new AthenaWindowTreeClient(container)); aura::client::SetWindowTreeClient(root_window_, window_tree_client_.get()); + + screen_position_client_.reset(new AthenaScreenPositionClient()); + aura::client::SetScreenPositionClient(root_window_, + screen_position_client_.get()); + return container; } @@ -148,6 +192,7 @@ ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) } ScreenManagerImpl::~ScreenManagerImpl() { + aura::client::SetScreenPositionClient(root_window_, NULL); aura::client::SetWindowTreeClient(root_window_, NULL); instance = NULL; } |