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

Side by Side Diff: ui/aura/env.cc

Issue 10895020: Merge aura::DispatcherLinux into base::MessagePumpAuraX11. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for sadrul Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/root_window_host_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/env.h" 5 #include "ui/aura/env.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "ui/aura/client/screen_position_client.h" 8 #include "ui/aura/client/screen_position_client.h"
9 #include "ui/aura/env_observer.h" 9 #include "ui/aura/env_observer.h"
10 #include "ui/aura/event_filter.h" 10 #include "ui/aura/event_filter.h"
11 #include "ui/aura/display_manager.h" 11 #include "ui/aura/display_manager.h"
12 #include "ui/aura/root_window_host.h" 12 #include "ui/aura/root_window_host.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/compositor/compositor.h" 14 #include "ui/compositor/compositor.h"
15 #include "ui/compositor/compositor_switches.h" 15 #include "ui/compositor/compositor_switches.h"
16 16
17 #if defined(USE_X11) 17 #if defined(USE_X11)
18 #include "base/message_pump_aurax11.h"
18 #include "ui/aura/display_change_observer_x11.h" 19 #include "ui/aura/display_change_observer_x11.h"
19 #endif 20 #endif
20 21
21 namespace aura { 22 namespace aura {
22 23
23 // static 24 // static
24 Env* Env::instance_ = NULL; 25 Env* Env::instance_ = NULL;
25 26
26 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
27 // Env, public: 28 // Env, public:
28 29
29 Env::Env() 30 Env::Env()
30 : mouse_button_flags_(0), 31 : mouse_button_flags_(0),
31 is_cursor_hidden_(false), 32 is_cursor_hidden_(false),
32 is_touch_down_(false), 33 is_touch_down_(false),
33 render_white_bg_(true), 34 render_white_bg_(true),
34 stacking_client_(NULL) { 35 stacking_client_(NULL) {
35 } 36 }
36 37
37 Env::~Env() { 38 Env::~Env() {
39 #if defined(USE_X11)
40 base::MessagePumpAuraX11::Current()->RemoveObserver(
41 &device_list_updater_aurax11_);
42 #endif
43
38 ui::Compositor::Terminate(); 44 ui::Compositor::Terminate();
39 } 45 }
40 46
41 // static 47 // static
42 Env* Env::GetInstance() { 48 Env* Env::GetInstance() {
43 if (!instance_) { 49 if (!instance_) {
44 instance_ = new Env; 50 instance_ = new Env;
45 instance_->Init(); 51 instance_->Init();
46 } 52 }
47 return instance_; 53 return instance_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 display_change_observer_->NotifyDisplayChange(); 96 display_change_observer_->NotifyDisplayChange();
91 #endif 97 #endif
92 } 98 }
93 99
94 void Env::SetEventFilter(EventFilter* event_filter) { 100 void Env::SetEventFilter(EventFilter* event_filter) {
95 event_filter_.reset(event_filter); 101 event_filter_.reset(event_filter);
96 } 102 }
97 103
98 #if !defined(OS_MACOSX) 104 #if !defined(OS_MACOSX)
99 MessageLoop::Dispatcher* Env::GetDispatcher() { 105 MessageLoop::Dispatcher* Env::GetDispatcher() {
106 #if defined(USE_X11)
107 return base::MessagePumpAuraX11::Current();
108 #else
100 return dispatcher_.get(); 109 return dispatcher_.get();
110 #endif
101 } 111 }
102 #endif 112 #endif
103 113
104 //////////////////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////////////////
105 // Env, private: 115 // Env, private:
106 116
107 void Env::Init() { 117 void Env::Init() {
108 #if !defined(OS_MACOSX) 118 #if defined(OS_WIN)
109 dispatcher_.reset(CreateDispatcher()); 119 dispatcher_.reset(CreateDispatcher());
110 #endif 120 #endif
111 #if defined(USE_X11) 121 #if defined(USE_X11)
112 display_change_observer_.reset(new internal::DisplayChangeObserverX11); 122 display_change_observer_.reset(new internal::DisplayChangeObserverX11);
123
124 // We can't do this with a root window listener because XI_HierarchyChanged
125 // messages don't have a target window.
126 base::MessagePumpAuraX11::Current()->AddObserver(
127 &device_list_updater_aurax11_);
113 #endif 128 #endif
114 ui::Compositor::Initialize( 129 ui::Compositor::Initialize(
115 CommandLine::ForCurrentProcess()->HasSwitch( 130 CommandLine::ForCurrentProcess()->HasSwitch(
116 switches::kUIEnableThreadedCompositing)); 131 switches::kUIEnableThreadedCompositing));
117 } 132 }
118 133
119 void Env::NotifyWindowInitialized(Window* window) { 134 void Env::NotifyWindowInitialized(Window* window) {
120 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); 135 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window));
121 } 136 }
122 137
123 } // namespace aura 138 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/root_window_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698