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

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

Issue 2057333002: X11: Wait for UnmapNotify before trying to remap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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.h" 5 #include "ui/events/platform/x11/x11_event_source.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/XKBlib.h> 8 #include <X11/XKBlib.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // not yet. 134 // not yet.
135 continue_stream_ = true; 135 continue_stream_ = true;
136 while (XPending(display_) && continue_stream_) { 136 while (XPending(display_) && continue_stream_) {
137 XEvent xevent; 137 XEvent xevent;
138 XNextEvent(display_, &xevent); 138 XNextEvent(display_, &xevent);
139 ExtractCookieDataDispatchEvent(&xevent); 139 ExtractCookieDataDispatchEvent(&xevent);
140 } 140 }
141 } 141 }
142 142
143 void X11EventSource::BlockUntilWindowMapped(XID window) { 143 void X11EventSource::BlockUntilWindowMapped(XID window) {
144 XEvent event; 144 BlockOnWindowStructureEvent(window, MapNotify);
145 do { 145 }
146 // Block until there's a message of |event_mask| type on |w|. Then remove 146
147 // it from the queue and stuff it in |event|. 147 void X11EventSource::BlockUntilWindowUnmapped(XID window) {
148 XWindowEvent(display_, window, StructureNotifyMask, &event); 148 BlockOnWindowStructureEvent(window, UnmapNotify);
149 ExtractCookieDataDispatchEvent(&event);
150 } while (event.type != MapNotify);
151 } 149 }
152 150
153 Time X11EventSource::UpdateLastSeenServerTime() { 151 Time X11EventSource::UpdateLastSeenServerTime() {
154 base::TimeTicks start = base::TimeTicks::Now(); 152 base::TimeTicks start = base::TimeTicks::Now();
155 153
156 DCHECK(display_); 154 DCHECK(display_);
157 155
158 if (!dummy_initialized_) { 156 if (!dummy_initialized_) {
159 // Create a new Window and Atom that will be used for the property change. 157 // Create a new Window and Atom that will be used for the property change.
160 dummy_window_ = XCreateSimpleWindow(display_, DefaultRootWindow(display_), 158 dummy_window_ = XCreateSimpleWindow(display_, DefaultRootWindow(display_),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 216 }
219 217
220 if (xevent->type == EnterNotify && 218 if (xevent->type == EnterNotify &&
221 xevent->xcrossing.detail != NotifyInferior && 219 xevent->xcrossing.detail != NotifyInferior &&
222 xevent->xcrossing.mode != NotifyUngrab) { 220 xevent->xcrossing.mode != NotifyUngrab) {
223 // Clear stored scroll data 221 // Clear stored scroll data
224 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); 222 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses();
225 } 223 }
226 } 224 }
227 225
226 void X11EventSource::BlockOnWindowStructureEvent(XID window, int type) {
227 XEvent event;
228 do {
229 // Block until there's a StructureNotify event of |type| on |window|. Then
230 // remove it from the queue and stuff it in |event|.
231 XWindowEvent(display_, window, StructureNotifyMask, &event);
232 ExtractCookieDataDispatchEvent(&event);
233 } while (event.type != type);
234 }
235
228 void X11EventSource::StopCurrentEventStream() { 236 void X11EventSource::StopCurrentEventStream() {
229 continue_stream_ = false; 237 continue_stream_ = false;
230 } 238 }
231 239
232 void X11EventSource::OnDispatcherListChanged() { 240 void X11EventSource::OnDispatcherListChanged() {
233 if (!hotplug_event_handler_) { 241 if (!hotplug_event_handler_) {
234 hotplug_event_handler_.reset(new X11HotplugEventHandler()); 242 hotplug_event_handler_.reset(new X11HotplugEventHandler());
235 // Force the initial device query to have an update list of active devices. 243 // Force the initial device query to have an update list of active devices.
236 hotplug_event_handler_->OnHotplugEvent(); 244 hotplug_event_handler_->OnHotplugEvent();
237 } 245 }
238 } 246 }
239 247
240 } // namespace ui 248 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/platform/x11/x11_event_source.h ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698