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.h" | 5 #include "ui/events/platform/x11/x11_event_source.h" |
6 | 6 |
7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
8 #include <X11/X.h> | 8 #include <X11/X.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // It may be useful to eventually align this event dispatch with vsync, but | 100 // It may be useful to eventually align this event dispatch with vsync, but |
101 // not yet. | 101 // not yet. |
102 continue_stream_ = true; | 102 continue_stream_ = true; |
103 while (XPending(display_) && continue_stream_) { | 103 while (XPending(display_) && continue_stream_) { |
104 XEvent xevent; | 104 XEvent xevent; |
105 XNextEvent(display_, &xevent); | 105 XNextEvent(display_, &xevent); |
106 ExtractCookieDataDispatchEvent(&xevent); | 106 ExtractCookieDataDispatchEvent(&xevent); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
| 110 void X11EventSource::DispatchEventNow(XEvent* event) { |
| 111 ExtractCookieDataDispatchEvent(event); |
| 112 } |
| 113 |
110 void X11EventSource::BlockUntilWindowMapped(XID window) { | 114 void X11EventSource::BlockUntilWindowMapped(XID window) { |
111 XEvent event; | 115 XEvent event; |
112 do { | 116 do { |
113 // Block until there's a message of |event_mask| type on |w|. Then remove | 117 // Block until there's a message of |event_mask| type on |w|. Then remove |
114 // it from the queue and stuff it in |event|. | 118 // it from the queue and stuff it in |event|. |
115 XWindowEvent(display_, window, StructureNotifyMask, &event); | 119 XWindowEvent(display_, window, StructureNotifyMask, &event); |
116 ExtractCookieDataDispatchEvent(&event); | 120 ExtractCookieDataDispatchEvent(&event); |
117 } while (event.type != MapNotify); | 121 } while (event.type != MapNotify); |
118 } | 122 } |
119 | 123 |
(...skipping 28 matching lines...) Expand all Loading... |
148 | 152 |
149 void X11EventSource::OnDispatcherListChanged() { | 153 void X11EventSource::OnDispatcherListChanged() { |
150 if (!hotplug_event_handler_) { | 154 if (!hotplug_event_handler_) { |
151 hotplug_event_handler_.reset(new X11HotplugEventHandler()); | 155 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
152 // Force the initial device query to have an update list of active devices. | 156 // Force the initial device query to have an update list of active devices. |
153 hotplug_event_handler_->OnHotplugEvent(); | 157 hotplug_event_handler_->OnHotplugEvent(); |
154 } | 158 } |
155 } | 159 } |
156 | 160 |
157 } // namespace ui | 161 } // namespace ui |
OLD | NEW |