| 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 "base/optional.h" | 13 #include "base/optional.h" |
| 14 #include "components/keyboard_lock/platform_key_event_filter.h" |
| 14 #include "ui/events/events_export.h" | 15 #include "ui/events/events_export.h" |
| 15 #include "ui/gfx/x/x11_types.h" | 16 #include "ui/gfx/x/x11_types.h" |
| 16 | 17 |
| 17 using Time = unsigned long; | 18 using Time = unsigned long; |
| 18 using XEvent = union _XEvent; | 19 using XEvent = union _XEvent; |
| 19 using XID = unsigned long; | 20 using XID = unsigned long; |
| 20 using XWindow = unsigned long; | 21 using XWindow = unsigned long; |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| 23 class Point; | 24 class Point; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // current event does not have a timestamp. | 81 // current event does not have a timestamp. |
| 81 Time GetTimestamp(); | 82 Time GetTimestamp(); |
| 82 | 83 |
| 83 // Returns the root pointer location only if there is an event being | 84 // Returns the root pointer location only if there is an event being |
| 84 // dispatched that contains that information. | 85 // dispatched that contains that information. |
| 85 base::Optional<gfx::Point> GetRootCursorLocationFromCurrentEvent() const; | 86 base::Optional<gfx::Point> GetRootCursorLocationFromCurrentEvent() const; |
| 86 | 87 |
| 87 void StopCurrentEventStream(); | 88 void StopCurrentEventStream(); |
| 88 void OnDispatcherListChanged(); | 89 void OnDispatcherListChanged(); |
| 89 | 90 |
| 91 void set_platform_key_event_filter( |
| 92 keyboard_lock::PlatformKeyEventFilter* filter); |
| 93 |
| 90 protected: | 94 protected: |
| 91 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches | 95 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches |
| 92 // the event. This function also frees up the cookie data after dispatch is | 96 // the event. This function also frees up the cookie data after dispatch is |
| 93 // complete. | 97 // complete. |
| 94 void ExtractCookieDataDispatchEvent(XEvent* xevent); | 98 void ExtractCookieDataDispatchEvent(XEvent* xevent); |
| 95 | 99 |
| 96 // Handles updates after event has been dispatched. | 100 // Handles updates after event has been dispatched. |
| 97 void PostDispatchEvent(XEvent* xevent); | 101 void PostDispatchEvent(XEvent* xevent); |
| 98 | 102 |
| 99 // Block until receiving a structure notify event of |type| on |window|. | 103 // Block until receiving a structure notify event of |type| on |window|. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 120 XWindow dummy_window_; | 124 XWindow dummy_window_; |
| 121 XAtom dummy_atom_; | 125 XAtom dummy_atom_; |
| 122 std::unique_ptr<XScopedEventSelector> dummy_window_events_; | 126 std::unique_ptr<XScopedEventSelector> dummy_window_events_; |
| 123 | 127 |
| 124 // Keeps track of whether this source should continue to dispatch all the | 128 // Keeps track of whether this source should continue to dispatch all the |
| 125 // available events. | 129 // available events. |
| 126 bool continue_stream_ = true; | 130 bool continue_stream_ = true; |
| 127 | 131 |
| 128 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; | 132 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; |
| 129 | 133 |
| 134 keyboard_lock::PlatformKeyEventFilter* filter_ = nullptr; |
| 135 |
| 130 DISALLOW_COPY_AND_ASSIGN(X11EventSource); | 136 DISALLOW_COPY_AND_ASSIGN(X11EventSource); |
| 131 }; | 137 }; |
| 132 | 138 |
| 133 } // namespace ui | 139 } // namespace ui |
| 134 | 140 |
| 135 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ | 141 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ |
| OLD | NEW |