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

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

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
« no previous file with comments | « no previous file | ui/events/platform/x11/x11_event_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ 5 #ifndef UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_
6 #define UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ 6 #define UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // xserver that |w| has been mapped; StructureNotifyMask events on |w| are 55 // xserver that |w| has been mapped; StructureNotifyMask events on |w| are
56 // pulled out from the queue and dispatched out of order. 56 // pulled out from the queue and dispatched out of order.
57 // 57 //
58 // For those that know X11, this is really a wrapper around XWindowEvent 58 // For those that know X11, this is really a wrapper around XWindowEvent
59 // which still makes sure the preempted event is dispatched instead of 59 // which still makes sure the preempted event is dispatched instead of
60 // dropped on the floor. This method exists because mapping a window is 60 // dropped on the floor. This method exists because mapping a window is
61 // asynchronous (and we receive an XEvent when mapped), while there are also 61 // asynchronous (and we receive an XEvent when mapped), while there are also
62 // functions which require a mapped window. 62 // functions which require a mapped window.
63 void BlockUntilWindowMapped(XID window); 63 void BlockUntilWindowMapped(XID window);
64 64
65 void BlockUntilWindowUnmapped(XID window);
66
65 XDisplay* display() { return display_; } 67 XDisplay* display() { return display_; }
66 Time last_seen_server_time() const { return last_seen_server_time_; } 68 Time last_seen_server_time() const { return last_seen_server_time_; }
67 69
68 // Explicitly asks the X11 server for the current timestamp, and updates 70 // Explicitly asks the X11 server for the current timestamp, and updates
69 // |last_seen_server_time| with this value. 71 // |last_seen_server_time| with this value.
70 Time UpdateLastSeenServerTime(); 72 Time UpdateLastSeenServerTime();
71 73
72 void StopCurrentEventStream(); 74 void StopCurrentEventStream();
73 void OnDispatcherListChanged(); 75 void OnDispatcherListChanged();
74 76
75 protected: 77 protected:
76 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches 78 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches
77 // the event. This function also frees up the cookie data after dispatch is 79 // the event. This function also frees up the cookie data after dispatch is
78 // complete. 80 // complete.
79 void ExtractCookieDataDispatchEvent(XEvent* xevent); 81 void ExtractCookieDataDispatchEvent(XEvent* xevent);
80 82
81 // Handles updates after event has been dispatched. 83 // Handles updates after event has been dispatched.
82 void PostDispatchEvent(XEvent* xevent); 84 void PostDispatchEvent(XEvent* xevent);
83 85
86 // Block until receiving a structure notify event of |type| on |window|.
87 // Dispatch all encountered events prior to the one we're blocking on.
88 void BlockOnWindowStructureEvent(XID window, int type);
89
84 private: 90 private:
85 static X11EventSource* instance_; 91 static X11EventSource* instance_;
86 92
87 X11EventSourceDelegate* delegate_; 93 X11EventSourceDelegate* delegate_;
88 94
89 // The connection to the X11 server used to receive the events. 95 // The connection to the X11 server used to receive the events.
90 XDisplay* display_; 96 XDisplay* display_;
91 97
92 // The last timestamp seen in an XEvent. 98 // The last timestamp seen in an XEvent.
93 Time last_seen_server_time_; 99 Time last_seen_server_time_;
94 100
95 // State necessary for UpdateLastSeenServerTime 101 // State necessary for UpdateLastSeenServerTime
96 bool dummy_initialized_; 102 bool dummy_initialized_;
97 XWindow dummy_window_; 103 XWindow dummy_window_;
98 XAtom dummy_atom_; 104 XAtom dummy_atom_;
99 105
100 // Keeps track of whether this source should continue to dispatch all the 106 // Keeps track of whether this source should continue to dispatch all the
101 // available events. 107 // available events.
102 bool continue_stream_ = true; 108 bool continue_stream_ = true;
103 109
104 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; 110 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_;
105 111
106 DISALLOW_COPY_AND_ASSIGN(X11EventSource); 112 DISALLOW_COPY_AND_ASSIGN(X11EventSource);
107 }; 113 };
108 114
109 } // namespace ui 115 } // namespace ui
110 116
111 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ 117 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/events/platform/x11/x11_event_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698