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 "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 } // namespace | 130 } // namespace |
131 | 131 |
132 X11EventSourceLibevent::X11EventSourceLibevent(XDisplay* display) | 132 X11EventSourceLibevent::X11EventSourceLibevent(XDisplay* display) |
133 : event_source_(this, display) { | 133 : event_source_(this, display) { |
134 AddEventWatcher(); | 134 AddEventWatcher(); |
135 } | 135 } |
136 | 136 |
137 X11EventSourceLibevent::~X11EventSourceLibevent() {} | 137 X11EventSourceLibevent::~X11EventSourceLibevent() {} |
138 | 138 |
| 139 // static |
| 140 X11EventSourceLibevent* X11EventSourceLibevent::GetInstance() { |
| 141 return static_cast<X11EventSourceLibevent*>( |
| 142 PlatformEventSource::GetInstance()); |
| 143 } |
| 144 |
139 void X11EventSourceLibevent::AddXEventDispatcher(XEventDispatcher* dispatcher) { | 145 void X11EventSourceLibevent::AddXEventDispatcher(XEventDispatcher* dispatcher) { |
140 dispatchers_xevent_.AddObserver(dispatcher); | 146 dispatchers_xevent_.AddObserver(dispatcher); |
141 } | 147 } |
142 | 148 |
143 void X11EventSourceLibevent::RemoveXEventDispatcher( | 149 void X11EventSourceLibevent::RemoveXEventDispatcher( |
144 XEventDispatcher* dispatcher) { | 150 XEventDispatcher* dispatcher) { |
145 dispatchers_xevent_.RemoveObserver(dispatcher); | 151 dispatchers_xevent_.RemoveObserver(dispatcher); |
146 } | 152 } |
147 | 153 |
148 void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { | 154 void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 196 |
191 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { | 197 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { |
192 event_source_.DispatchXEvents(); | 198 event_source_.DispatchXEvents(); |
193 } | 199 } |
194 | 200 |
195 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { | 201 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { |
196 NOTREACHED(); | 202 NOTREACHED(); |
197 } | 203 } |
198 | 204 |
199 } // namespace ui | 205 } // namespace ui |
OLD | NEW |