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

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

Issue 2287583003: Linux: Remove --wm-user-time-ms command line argument (Closed)
Patch Set: Deprecate histogram Created 4 years, 3 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 | « ui/base/x/selection_owner.cc ('k') | 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // For those that know X11, this is really a wrapper around XWindowEvent 63 // For those that know X11, this is really a wrapper around XWindowEvent
64 // which still makes sure the preempted event is dispatched instead of 64 // which still makes sure the preempted event is dispatched instead of
65 // dropped on the floor. This method exists because mapping a window is 65 // dropped on the floor. This method exists because mapping a window is
66 // asynchronous (and we receive an XEvent when mapped), while there are also 66 // asynchronous (and we receive an XEvent when mapped), while there are also
67 // functions which require a mapped window. 67 // functions which require a mapped window.
68 void BlockUntilWindowMapped(XID window); 68 void BlockUntilWindowMapped(XID window);
69 69
70 void BlockUntilWindowUnmapped(XID window); 70 void BlockUntilWindowUnmapped(XID window);
71 71
72 XDisplay* display() { return display_; } 72 XDisplay* display() { return display_; }
73 Time last_seen_server_time() const { return last_seen_server_time_; }
74
75 // Explicitly asks the X11 server for the current timestamp, and updates
76 // |last_seen_server_time_| with this value.
77 Time UpdateLastSeenServerTime();
78
79 // Sets |last_seen_server_time_| to |time| if this would cause the time to
80 // move forward.
81 void SetLastSeenServerTime(Time time);
82 73
83 // Returns the timestamp of the event currently being dispatched. Falls back 74 // Returns the timestamp of the event currently being dispatched. Falls back
84 // on UpdateLastSeenServerTime() if there's no event being dispatched, or if 75 // on GetCurrentServerTime() if there's no event being dispatched, or if the
85 // the current event does not have a timestamp. 76 // current event does not have a timestamp.
86 Time GetTimestamp(); 77 Time GetTimestamp();
87 78
88 void StopCurrentEventStream(); 79 void StopCurrentEventStream();
89 void OnDispatcherListChanged(); 80 void OnDispatcherListChanged();
90 81
91 protected: 82 protected:
92 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches 83 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches
93 // the event. This function also frees up the cookie data after dispatch is 84 // the event. This function also frees up the cookie data after dispatch is
94 // complete. 85 // complete.
95 void ExtractCookieDataDispatchEvent(XEvent* xevent); 86 void ExtractCookieDataDispatchEvent(XEvent* xevent);
96 87
97 // Handles updates after event has been dispatched. 88 // Handles updates after event has been dispatched.
98 void PostDispatchEvent(XEvent* xevent); 89 void PostDispatchEvent(XEvent* xevent);
99 90
100 // Block until receiving a structure notify event of |type| on |window|. 91 // Block until receiving a structure notify event of |type| on |window|.
101 // Dispatch all encountered events prior to the one we're blocking on. 92 // Dispatch all encountered events prior to the one we're blocking on.
102 void BlockOnWindowStructureEvent(XID window, int type); 93 void BlockOnWindowStructureEvent(XID window, int type);
103 94
95 // Explicitly asks the X11 server for the current timestamp, and updates
96 // |last_seen_server_time_| with this value.
97 Time GetCurrentServerTime();
98
104 private: 99 private:
105 static X11EventSource* instance_; 100 static X11EventSource* instance_;
106 101
107 X11EventSourceDelegate* delegate_; 102 X11EventSourceDelegate* delegate_;
108 103
109 // The connection to the X11 server used to receive the events. 104 // The connection to the X11 server used to receive the events.
110 XDisplay* display_; 105 XDisplay* display_;
111 106
112 // The last timestamp seen in an XEvent.
113 Time last_seen_server_time_;
114
115 // The timestamp of the event being dispatched. 107 // The timestamp of the event being dispatched.
116 Time event_timestamp_; 108 Time event_timestamp_;
117 109
118 // State necessary for UpdateLastSeenServerTime 110 // State necessary for UpdateLastSeenServerTime
119 bool dummy_initialized_; 111 bool dummy_initialized_;
120 XWindow dummy_window_; 112 XWindow dummy_window_;
121 XAtom dummy_atom_; 113 XAtom dummy_atom_;
122 114
123 // Keeps track of whether this source should continue to dispatch all the 115 // Keeps track of whether this source should continue to dispatch all the
124 // available events. 116 // available events.
125 bool continue_stream_ = true; 117 bool continue_stream_ = true;
126 118
127 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; 119 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_;
128 120
129 DISALLOW_COPY_AND_ASSIGN(X11EventSource); 121 DISALLOW_COPY_AND_ASSIGN(X11EventSource);
130 }; 122 };
131 123
132 } // namespace ui 124 } // namespace ui
133 125
134 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ 126 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_
OLDNEW
« no previous file with comments | « ui/base/x/selection_owner.cc ('k') | ui/events/platform/x11/x11_event_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698