Chromium Code Reviews| 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> | 10 #include <memory> |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 } | 151 } |
| 152 | 152 |
| 153 void X11EventSourceLibevent::RemoveXEventDispatcher( | 153 void X11EventSourceLibevent::RemoveXEventDispatcher( |
| 154 XEventDispatcher* dispatcher) { | 154 XEventDispatcher* dispatcher) { |
| 155 dispatchers_xevent_.RemoveObserver(dispatcher); | 155 dispatchers_xevent_.RemoveObserver(dispatcher); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { | 158 void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { |
| 159 std::unique_ptr<ui::Event> translated_event = TranslateXEventToEvent(*xevent); | 159 std::unique_ptr<ui::Event> translated_event = TranslateXEventToEvent(*xevent); |
| 160 if (translated_event) { | 160 if (translated_event) { |
| 161 DispatchEvent(translated_event.get()); | 161 EventWithPlatformEvent ewxe = {translated_event.get(), xevent}; |
| 162 DispatchEvent(&ewxe); | |
|
sadrul
2017/04/04 04:02:06
This is fairly hacky.
Maybe this should always go
| |
| 162 } else { | 163 } else { |
| 163 // Only if we can't translate XEvent into ui::Event, try to dispatch XEvent | 164 // Only if we can't translate XEvent into ui::Event, try to dispatch XEvent |
| 164 // directly to XEventDispatchers. | 165 // directly to XEventDispatchers. |
| 165 DispatchXEventToXEventDispatchers(xevent); | 166 DispatchXEventToXEventDispatchers(xevent); |
| 166 } | 167 } |
| 167 } | 168 } |
| 168 | 169 |
| 169 void X11EventSourceLibevent::AddEventWatcher() { | 170 void X11EventSourceLibevent::AddEventWatcher() { |
| 170 if (initialized_) | 171 if (initialized_) |
| 171 return; | 172 return; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 197 | 198 |
| 198 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { | 199 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { |
| 199 event_source_.DispatchXEvents(); | 200 event_source_.DispatchXEvents(); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { | 203 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { |
| 203 NOTREACHED(); | 204 NOTREACHED(); |
| 204 } | 205 } |
| 205 | 206 |
| 206 } // namespace ui | 207 } // namespace ui |
| OLD | NEW |