| 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> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "ui/events/events_export.h" | 13 #include "ui/events/events_export.h" |
| 14 #include "ui/gfx/x/x11_types.h" | 14 #include "ui/gfx/x/x11_types.h" |
| 15 | 15 |
| 16 using Time = unsigned long; | 16 using Time = unsigned long; |
| 17 using XEvent = union _XEvent; | 17 using XEvent = union _XEvent; |
| 18 using XID = unsigned long; | 18 using XID = unsigned long; |
| 19 using XWindow = unsigned long; | 19 using XWindow = unsigned long; |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 | 22 |
| 23 class X11HotplugEventHandler; | 23 class X11HotplugEventHandler; |
| 24 class XScopedEventSelector; |
| 24 | 25 |
| 25 // Responsible for notifying X11EventSource when new XEvents are available and | 26 // Responsible for notifying X11EventSource when new XEvents are available and |
| 26 // processing/dispatching XEvents. Implementations will likely be a | 27 // processing/dispatching XEvents. Implementations will likely be a |
| 27 // PlatformEventSource. | 28 // PlatformEventSource. |
| 28 class X11EventSourceDelegate { | 29 class X11EventSourceDelegate { |
| 29 public: | 30 public: |
| 30 X11EventSourceDelegate() = default; | 31 X11EventSourceDelegate() = default; |
| 31 | 32 |
| 32 // Processes (if necessary) and handles dispatching XEvents. | 33 // Processes (if necessary) and handles dispatching XEvents. |
| 33 virtual void ProcessXEvent(XEvent* xevent) = 0; | 34 virtual void ProcessXEvent(XEvent* xevent) = 0; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // The connection to the X11 server used to receive the events. | 105 // The connection to the X11 server used to receive the events. |
| 105 XDisplay* display_; | 106 XDisplay* display_; |
| 106 | 107 |
| 107 // The timestamp of the event being dispatched. | 108 // The timestamp of the event being dispatched. |
| 108 Time event_timestamp_; | 109 Time event_timestamp_; |
| 109 | 110 |
| 110 // State necessary for UpdateLastSeenServerTime | 111 // State necessary for UpdateLastSeenServerTime |
| 111 bool dummy_initialized_; | 112 bool dummy_initialized_; |
| 112 XWindow dummy_window_; | 113 XWindow dummy_window_; |
| 113 XAtom dummy_atom_; | 114 XAtom dummy_atom_; |
| 115 std::unique_ptr<XScopedEventSelector> dummy_window_events_; |
| 114 | 116 |
| 115 // Keeps track of whether this source should continue to dispatch all the | 117 // Keeps track of whether this source should continue to dispatch all the |
| 116 // available events. | 118 // available events. |
| 117 bool continue_stream_ = true; | 119 bool continue_stream_ = true; |
| 118 | 120 |
| 119 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; | 121 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; |
| 120 | 122 |
| 121 DISALLOW_COPY_AND_ASSIGN(X11EventSource); | 123 DISALLOW_COPY_AND_ASSIGN(X11EventSource); |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace ui | 126 } // namespace ui |
| 125 | 127 |
| 126 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ | 128 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ |
| OLD | NEW |