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

Side by Side Diff: ui/events/platform/x11/x11_event_source_libevent.cc

Issue 2791693003: [Ozone/x11] events can be dispatched to the wrong window
Patch Set: Created 3 years, 8 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698