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

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

Issue 2165083002: Linux: Refactor X11DesktopHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT 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/events/devices/x11/touch_factory_x11.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_; } 73 Time last_seen_server_time() const { return last_seen_server_time_; }
74 74
75 // Explicitly asks the X11 server for the current timestamp, and updates 75 // Explicitly asks the X11 server for the current timestamp, and updates
76 // |last_seen_server_time| with this value. 76 // |last_seen_server_time_| with this value.
77 Time UpdateLastSeenServerTime(); 77 Time UpdateLastSeenServerTime();
78 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
83 // Returns the timestamp of the event currently being dispatched. Falls back
84 // on UpdateLastSeenServerTime() if there's no event being dispatched, or if
85 // the current event does not have a timestamp.
86 Time GetTimestamp();
87
79 void StopCurrentEventStream(); 88 void StopCurrentEventStream();
80 void OnDispatcherListChanged(); 89 void OnDispatcherListChanged();
81 90
82 protected: 91 protected:
83 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches 92 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches
84 // the event. This function also frees up the cookie data after dispatch is 93 // the event. This function also frees up the cookie data after dispatch is
85 // complete. 94 // complete.
86 void ExtractCookieDataDispatchEvent(XEvent* xevent); 95 void ExtractCookieDataDispatchEvent(XEvent* xevent);
87 96
88 // Handles updates after event has been dispatched. 97 // Handles updates after event has been dispatched.
89 void PostDispatchEvent(XEvent* xevent); 98 void PostDispatchEvent(XEvent* xevent);
90 99
91 // Block until receiving a structure notify event of |type| on |window|. 100 // Block until receiving a structure notify event of |type| on |window|.
92 // Dispatch all encountered events prior to the one we're blocking on. 101 // Dispatch all encountered events prior to the one we're blocking on.
93 void BlockOnWindowStructureEvent(XID window, int type); 102 void BlockOnWindowStructureEvent(XID window, int type);
94 103
95 private: 104 private:
96 static X11EventSource* instance_; 105 static X11EventSource* instance_;
97 106
98 X11EventSourceDelegate* delegate_; 107 X11EventSourceDelegate* delegate_;
99 108
100 // The connection to the X11 server used to receive the events. 109 // The connection to the X11 server used to receive the events.
101 XDisplay* display_; 110 XDisplay* display_;
102 111
103 // The last timestamp seen in an XEvent. 112 // The last timestamp seen in an XEvent.
104 Time last_seen_server_time_; 113 Time last_seen_server_time_;
105 114
115 // The timestamp of the event being dispatched.
116 Time event_timestamp_;
117
106 // State necessary for UpdateLastSeenServerTime 118 // State necessary for UpdateLastSeenServerTime
107 bool dummy_initialized_; 119 bool dummy_initialized_;
108 XWindow dummy_window_; 120 XWindow dummy_window_;
109 XAtom dummy_atom_; 121 XAtom dummy_atom_;
110 122
111 // Keeps track of whether this source should continue to dispatch all the 123 // Keeps track of whether this source should continue to dispatch all the
112 // available events. 124 // available events.
113 bool continue_stream_ = true; 125 bool continue_stream_ = true;
114 126
115 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; 127 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_;
116 128
117 DISALLOW_COPY_AND_ASSIGN(X11EventSource); 129 DISALLOW_COPY_AND_ASSIGN(X11EventSource);
118 }; 130 };
119 131
120 } // namespace ui 132 } // namespace ui
121 133
122 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ 134 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_
OLDNEW
« no previous file with comments | « ui/events/devices/x11/touch_factory_x11.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