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

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

Issue 23880006: gtk: Allow building both the X11 and Gtk message-pumps for gtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 7 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/demo/demo_main.cc ('k') | ui/aura/root_window_host_x11.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/env_observer.h" 8 #include "ui/aura/env_observer.h"
9 #include "ui/aura/root_window_host.h" 9 #include "ui/aura/root_window_host.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/compositor/compositor.h" 11 #include "ui/compositor/compositor.h"
12 #include "ui/compositor/compositor_switches.h" 12 #include "ui/compositor/compositor_switches.h"
13 13
14 #if defined(USE_X11) 14 #if defined(USE_X11)
15 #include "base/message_loop/message_pump_aurax11.h" 15 #include "base/message_loop/message_pump_x11.h"
16 #endif 16 #endif
17 17
18 namespace aura { 18 namespace aura {
19 19
20 // static 20 // static
21 Env* Env::instance_ = NULL; 21 Env* Env::instance_ = NULL;
22 22
23 //////////////////////////////////////////////////////////////////////////////// 23 ////////////////////////////////////////////////////////////////////////////////
24 // Env, public: 24 // Env, public:
25 25
26 Env::Env() 26 Env::Env()
27 : mouse_button_flags_(0), 27 : mouse_button_flags_(0),
28 is_touch_down_(false) { 28 is_touch_down_(false) {
29 } 29 }
30 30
31 Env::~Env() { 31 Env::~Env() {
32 #if defined(USE_X11) 32 #if defined(USE_X11)
33 base::MessagePumpAuraX11::Current()->RemoveObserver( 33 base::MessagePumpX11::Current()->RemoveObserver(
34 &device_list_updater_aurax11_); 34 &device_list_updater_aurax11_);
35 #endif 35 #endif
36 36
37 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv()); 37 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWillDestroyEnv());
38 38
39 ui::Compositor::Terminate(); 39 ui::Compositor::Terminate();
40 } 40 }
41 41
42 // static 42 // static
43 Env* Env::GetInstance() { 43 Env* Env::GetInstance() {
(...skipping 14 matching lines...) Expand all
58 observers_.AddObserver(observer); 58 observers_.AddObserver(observer);
59 } 59 }
60 60
61 void Env::RemoveObserver(EnvObserver* observer) { 61 void Env::RemoveObserver(EnvObserver* observer) {
62 observers_.RemoveObserver(observer); 62 observers_.RemoveObserver(observer);
63 } 63 }
64 64
65 #if !defined(OS_MACOSX) 65 #if !defined(OS_MACOSX)
66 base::MessageLoop::Dispatcher* Env::GetDispatcher() { 66 base::MessageLoop::Dispatcher* Env::GetDispatcher() {
67 #if defined(USE_X11) 67 #if defined(USE_X11)
68 return base::MessagePumpAuraX11::Current(); 68 return base::MessagePumpX11::Current();
69 #else 69 #else
70 return dispatcher_.get(); 70 return dispatcher_.get();
71 #endif 71 #endif
72 } 72 }
73 #endif 73 #endif
74 74
75 void Env::RootWindowActivated(RootWindow* root_window) { 75 void Env::RootWindowActivated(RootWindow* root_window) {
76 FOR_EACH_OBSERVER(EnvObserver, observers_, 76 FOR_EACH_OBSERVER(EnvObserver, observers_,
77 OnRootWindowActivated(root_window)); 77 OnRootWindowActivated(root_window));
78 } 78 }
79 79
80 //////////////////////////////////////////////////////////////////////////////// 80 ////////////////////////////////////////////////////////////////////////////////
81 // Env, private: 81 // Env, private:
82 82
83 void Env::Init() { 83 void Env::Init() {
84 #if !defined(USE_X11) && !defined(USE_OZONE) 84 #if !defined(USE_X11) && !defined(USE_OZONE)
85 dispatcher_.reset(CreateDispatcher()); 85 dispatcher_.reset(CreateDispatcher());
86 #endif 86 #endif
87 #if defined(USE_X11) 87 #if defined(USE_X11)
88 // We can't do this with a root window listener because XI_HierarchyChanged 88 // We can't do this with a root window listener because XI_HierarchyChanged
89 // messages don't have a target window. 89 // messages don't have a target window.
90 base::MessagePumpAuraX11::Current()->AddObserver( 90 base::MessagePumpX11::Current()->AddObserver(
91 &device_list_updater_aurax11_); 91 &device_list_updater_aurax11_);
92 #endif 92 #endif
93 ui::Compositor::Initialize(); 93 ui::Compositor::Initialize();
94 } 94 }
95 95
96 void Env::NotifyWindowInitialized(Window* window) { 96 void Env::NotifyWindowInitialized(Window* window) {
97 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); 97 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window));
98 } 98 }
99 99
100 void Env::NotifyRootWindowInitialized(RootWindow* root_window) { 100 void Env::NotifyRootWindowInitialized(RootWindow* root_window) {
101 FOR_EACH_OBSERVER(EnvObserver, 101 FOR_EACH_OBSERVER(EnvObserver,
102 observers_, 102 observers_,
103 OnRootWindowInitialized(root_window)); 103 OnRootWindowInitialized(root_window));
104 } 104 }
105 105
106 //////////////////////////////////////////////////////////////////////////////// 106 ////////////////////////////////////////////////////////////////////////////////
107 // Env, ui::EventTarget implementation: 107 // Env, ui::EventTarget implementation:
108 108
109 bool Env::CanAcceptEvent(const ui::Event& event) { 109 bool Env::CanAcceptEvent(const ui::Event& event) {
110 return true; 110 return true;
111 } 111 }
112 112
113 ui::EventTarget* Env::GetParentTarget() { 113 ui::EventTarget* Env::GetParentTarget() {
114 return NULL; 114 return NULL;
115 } 115 }
116 116
117 } // namespace aura 117 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/demo/demo_main.cc ('k') | ui/aura/root_window_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698