OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/events/platform/x11/x11_event_source_libevent.h" | 5 #include "ui/events/platform/x11/x11_event_source_libevent.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
11 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
12 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
13 #include "ui/events/event_utils.h" | 15 #include "ui/events/event_utils.h" |
14 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 16 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
15 #include "ui/events/platform/platform_event_dispatcher.h" | 17 #include "ui/events/platform/platform_event_dispatcher.h" |
16 #include "ui/events/x/events_x_utils.h" | 18 #include "ui/events/x/events_x_utils.h" |
17 | 19 |
18 namespace ui { | 20 namespace ui { |
19 | 21 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 132 |
131 } // namespace | 133 } // namespace |
132 | 134 |
133 X11EventSourceLibevent::X11EventSourceLibevent(XDisplay* display) | 135 X11EventSourceLibevent::X11EventSourceLibevent(XDisplay* display) |
134 : event_source_(this, display) { | 136 : event_source_(this, display) { |
135 AddEventWatcher(); | 137 AddEventWatcher(); |
136 } | 138 } |
137 | 139 |
138 X11EventSourceLibevent::~X11EventSourceLibevent() {} | 140 X11EventSourceLibevent::~X11EventSourceLibevent() {} |
139 | 141 |
| 142 // static |
| 143 X11EventSourceLibevent* X11EventSourceLibevent::GetInstance() { |
| 144 return static_cast<X11EventSourceLibevent*>( |
| 145 PlatformEventSource::GetInstance()); |
| 146 } |
| 147 |
140 void X11EventSourceLibevent::AddXEventDispatcher(XEventDispatcher* dispatcher) { | 148 void X11EventSourceLibevent::AddXEventDispatcher(XEventDispatcher* dispatcher) { |
141 dispatchers_xevent_.AddObserver(dispatcher); | 149 dispatchers_xevent_.AddObserver(dispatcher); |
142 } | 150 } |
143 | 151 |
144 void X11EventSourceLibevent::RemoveXEventDispatcher( | 152 void X11EventSourceLibevent::RemoveXEventDispatcher( |
145 XEventDispatcher* dispatcher) { | 153 XEventDispatcher* dispatcher) { |
146 dispatchers_xevent_.RemoveObserver(dispatcher); | 154 dispatchers_xevent_.RemoveObserver(dispatcher); |
147 } | 155 } |
148 | 156 |
149 void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { | 157 void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 199 |
192 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { | 200 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { |
193 event_source_.DispatchXEvents(); | 201 event_source_.DispatchXEvents(); |
194 } | 202 } |
195 | 203 |
196 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { | 204 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { |
197 NOTREACHED(); | 205 NOTREACHED(); |
198 } | 206 } |
199 | 207 |
200 } // namespace ui | 208 } // namespace ui |
OLD | NEW |