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