Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: ui/aura/env.cc

Issue 9808010: Keep the mouse cursor within desktop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/monitor_change_observer_x11.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/env.cc
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 32ead2bce410fd08bc3d093b2f597240ba0a71e3..6da06ef49adb4f7a679e57e870047e5582662dee 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -23,16 +23,7 @@ Env* Env::instance_ = NULL;
Env::Env()
: mouse_button_flags_(0),
- stacking_client_(NULL),
- monitor_manager_(new internal::SingleMonitorManager)
-#if defined(USE_X11)
- , monitor_change_observer_(new MonitorChangeObserverX11())
-#endif
-{
-#if !defined(OS_MACOSX)
- dispatcher_.reset(CreateDispatcher());
-#endif
- ui::Compositor::Initialize(false);
+ stacking_client_(NULL) {
}
Env::~Env() {
@@ -41,8 +32,10 @@ Env::~Env() {
// static
Env* Env::GetInstance() {
- if (!instance_)
+ if (!instance_) {
instance_ = new Env;
+ instance_->Init();
oshima 2012/03/24 18:19:39 Ben, I had to move init code out of constructor to
+ }
return instance_;
}
@@ -62,6 +55,10 @@ void Env::RemoveObserver(EnvObserver* observer) {
void Env::SetMonitorManager(MonitorManager* monitor_manager) {
monitor_manager_.reset(monitor_manager);
+#if defined(USE_X11)
+ // Update the monitor manager with latest info.
+ monitor_change_observer_->NotifyMonitorChange();
+#endif
}
#if !defined(OS_MACOSX)
@@ -73,6 +70,17 @@ MessageLoop::Dispatcher* Env::GetDispatcher() {
////////////////////////////////////////////////////////////////////////////////
// Env, private:
+void Env::Init() {
+#if !defined(OS_MACOSX)
+ dispatcher_.reset(CreateDispatcher());
+#endif
+#if defined(USE_X11)
+ monitor_change_observer_.reset(new internal::MonitorChangeObserverX11);
+#endif
+ SetMonitorManager(new internal::SingleMonitorManager);
+ ui::Compositor::Initialize(false);
+}
+
void Env::NotifyWindowInitialized(Window* window) {
FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window));
}
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/monitor_change_observer_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698