diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 20:56:28 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 20:56:28 +0000 |
commit | 193b39d2ef3ec7a4f1692fd4448c515c06bb46d1 (patch) | |
tree | b35587f06293535725508764137b06c6c413c5ff /ash | |
parent | 911cbcdade8c9386b68e3ee87cb9c2ea1c48db8e (diff) | |
download | chromium_src-193b39d2ef3ec7a4f1692fd4448c515c06bb46d1.zip chromium_src-193b39d2ef3ec7a4f1692fd4448c515c06bb46d1.tar.gz chromium_src-193b39d2ef3ec7a4f1692fd4448c515c06bb46d1.tar.bz2 |
Native bounds support to host windows.
* Moved SingleMonitorManager into separate file. This is a default
MonitorManager and creates RootWindow for PrimaryMonitor.
* Added MonitorObserver and moved monitor change logic to ash.
* MultiMonitorManager class and its layout logic will live in ash too.
* Added ability to move host window so that we can re-arrange root window when
switching primary monitor.
* Removed monitor_manager_x11, which I committed by accident.
* Use (0,0) for monitor/workarea bounds because the coordinate isn't translated yet
for non primary screens.
BUG=115510
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9703083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/screen_ash.cc | 11 | ||||
-rw-r--r-- | ash/shell.cc | 16 | ||||
-rw-r--r-- | ash/shell.h | 6 |
3 files changed, 27 insertions, 6 deletions
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc index 9847480..c884a15 100644 --- a/ash/screen_ash.cc +++ b/ash/screen_ash.cc @@ -12,6 +12,10 @@ namespace ash { +// TODO(oshima): For m19, the origin of work area/monitor bounds for +// views/aura is (0,0) because it's simple and enough. Fix this when +// real multi monitor support is implemented. + namespace { const aura::MonitorManager* GetMonitorManager() { return aura::Env::GetInstance()->monitor_manager(); @@ -37,7 +41,9 @@ gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestWindowImpl( gfx::Rect ScreenAsh::GetMonitorAreaNearestWindowImpl( gfx::NativeWindow window) { - return GetMonitorManager()->GetMonitorNearestWindow(window)->bounds(); + // See the comment at the top. + return gfx::Rect( + GetMonitorManager()->GetMonitorNearestWindow(window)->size()); } gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestPointImpl( @@ -47,7 +53,8 @@ gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestPointImpl( } gfx::Rect ScreenAsh::GetMonitorAreaNearestPointImpl(const gfx::Point& point) { - return GetMonitorManager()->GetMonitorNearestPoint(point)->bounds(); + // See the comment at the top. + return gfx::Rect(GetMonitorManager()->GetMonitorNearestPoint(point)->size()); } gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPointImpl() { diff --git a/ash/shell.cc b/ash/shell.cc index 0bac7f1..5aec3bd 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -65,6 +65,7 @@ #include "ui/aura/layout_manager.h" #include "ui/aura/monitor.h" #include "ui/aura/monitor_manager.h" +#include "ui/aura/monitor_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/ui_controls_aura.h" #include "ui/aura/window.h" @@ -392,20 +393,21 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() { // Shell, public: Shell::Shell(ShellDelegate* delegate) - : root_window_(new aura::RootWindow), + : root_window_(aura::Env::GetInstance()->monitor_manager()-> + CreateRootWindowForPrimaryMonitor()), screen_(new ScreenAsh(root_window_.get())), root_filter_(NULL), delegate_(delegate), shelf_(NULL), root_window_layout_(NULL), status_widget_(NULL) { - aura::Env::GetInstance()->SetMonitorManager( - aura::CreateSingleMonitorManager(root_window_.get())); gfx::Screen::SetInstance(screen_); ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); + aura::Env::GetInstance()->monitor_manager()->AddObserver(this); } Shell::~Shell() { + aura::Env::GetInstance()->monitor_manager()->RemoveObserver(this); RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); RemoveRootWindowEventFilter(input_method_filter_.get()); RemoveRootWindowEventFilter(window_modality_controller_.get()); @@ -693,6 +695,14 @@ int Shell::GetGridSize() const { } //////////////////////////////////////////////////////////////////////////////// +// Shell, aura::MonitorObserver implementation: + +void Shell::OnMonitorBoundsChanged(const aura::Monitor* monitor) { + if (aura::RootWindow::use_fullscreen_host_window()) + root_window_->SetHostSize(monitor->size()); +} + +//////////////////////////////////////////////////////////////////////////////// // Shell, private: void Shell::InitLayoutManagers() { diff --git a/ash/shell.h b/ash/shell.h index 29e6e2b..ff52a12 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -15,6 +15,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" +#include "ui/aura/monitor_manager.h" #include "ui/gfx/size.h" #include "ui/gfx/insets.h" @@ -77,7 +78,7 @@ class WorkspaceController; // // Upon creation, the Shell sets itself as the RootWindow's delegate, which // takes ownership of the Shell. -class ASH_EXPORT Shell { +class ASH_EXPORT Shell : public aura::MonitorObserver { public: enum Direction { FORWARD, @@ -200,6 +201,9 @@ class ASH_EXPORT Shell { // Returns the size of the grid. int GetGridSize() const; + // aura::MonitorObserver overrides: + virtual void OnMonitorBoundsChanged(const aura::Monitor* monitor) OVERRIDE; + static void set_initially_hide_cursor(bool hide) { initially_hide_cursor_ = hide; } |