Chromium Code Reviews| 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 #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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 | 70 |
| 71 void BlockUntilWindowUnmapped(XID window); | 71 void BlockUntilWindowUnmapped(XID window); |
| 72 | 72 |
| 73 XDisplay* display() { return display_; } | 73 XDisplay* display() { return display_; } |
| 74 | 74 |
| 75 // Returns the timestamp of the event currently being dispatched. Falls back | 75 // Returns the timestamp of the event currently being dispatched. Falls back |
| 76 // on GetCurrentServerTime() if there's no event being dispatched, or if the | 76 // on GetCurrentServerTime() if there's no event being dispatched, or if the |
| 77 // current event does not have a timestamp. | 77 // current event does not have a timestamp. |
| 78 Time GetTimestamp(); | 78 Time GetTimestamp(); |
| 79 | 79 |
| 80 // If an event is being dispatched, copies the event into *|event| and | |
| 81 // returns true. Otherwise *|event| is untouched and this returns false. | |
| 82 const XEvent* get_dispatching_event() const { return dispatching_event_; } | |
|
sadrul
2016/10/07 02:12:51
Exposing the raw XEvent feels more icky. I would p
Tom (Use chromium acct)
2016/10/07 21:13:18
Done.
| |
| 83 | |
| 80 void StopCurrentEventStream(); | 84 void StopCurrentEventStream(); |
| 81 void OnDispatcherListChanged(); | 85 void OnDispatcherListChanged(); |
| 82 | 86 |
| 83 protected: | 87 protected: |
| 84 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches | 88 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches |
| 85 // the event. This function also frees up the cookie data after dispatch is | 89 // the event. This function also frees up the cookie data after dispatch is |
| 86 // complete. | 90 // complete. |
| 87 void ExtractCookieDataDispatchEvent(XEvent* xevent); | 91 void ExtractCookieDataDispatchEvent(XEvent* xevent); |
| 88 | 92 |
| 89 // Handles updates after event has been dispatched. | 93 // Handles updates after event has been dispatched. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 101 static X11EventSource* instance_; | 105 static X11EventSource* instance_; |
| 102 | 106 |
| 103 X11EventSourceDelegate* delegate_; | 107 X11EventSourceDelegate* delegate_; |
| 104 | 108 |
| 105 // The connection to the X11 server used to receive the events. | 109 // The connection to the X11 server used to receive the events. |
| 106 XDisplay* display_; | 110 XDisplay* display_; |
| 107 | 111 |
| 108 // The timestamp of the event being dispatched. | 112 // The timestamp of the event being dispatched. |
| 109 Time event_timestamp_; | 113 Time event_timestamp_; |
| 110 | 114 |
| 115 // The event being dispatched, or nullptr if there is none. | |
| 116 XEvent* dispatching_event_; | |
| 117 | |
| 111 // State necessary for UpdateLastSeenServerTime | 118 // State necessary for UpdateLastSeenServerTime |
| 112 bool dummy_initialized_; | 119 bool dummy_initialized_; |
| 113 XWindow dummy_window_; | 120 XWindow dummy_window_; |
| 114 XAtom dummy_atom_; | 121 XAtom dummy_atom_; |
| 115 std::unique_ptr<XScopedEventSelector> dummy_window_events_; | 122 std::unique_ptr<XScopedEventSelector> dummy_window_events_; |
| 116 | 123 |
| 117 // Keeps track of whether this source should continue to dispatch all the | 124 // Keeps track of whether this source should continue to dispatch all the |
| 118 // available events. | 125 // available events. |
| 119 bool continue_stream_ = true; | 126 bool continue_stream_ = true; |
| 120 | 127 |
| 121 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; | 128 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; |
| 122 | 129 |
| 123 DISALLOW_COPY_AND_ASSIGN(X11EventSource); | 130 DISALLOW_COPY_AND_ASSIGN(X11EventSource); |
| 124 }; | 131 }; |
| 125 | 132 |
| 126 } // namespace ui | 133 } // namespace ui |
| 127 | 134 |
| 128 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ | 135 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ |
| OLD | NEW |