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_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 class DeviceManager; | 31 class DeviceManager; |
32 class InputDeviceFactoryEvdev; | 32 class InputDeviceFactoryEvdev; |
33 class SystemInputInjector; | 33 class SystemInputInjector; |
34 enum class DomCode; | 34 enum class DomCode; |
35 | 35 |
36 #if !defined(USE_EVDEV) | 36 #if !defined(USE_EVDEV) |
37 #error Missing dependency on ui/events/ozone:events_ozone_evdev | 37 #error Missing dependency on ui/events/ozone:events_ozone_evdev |
38 #endif | 38 #endif |
39 | 39 |
40 // Ozone events implementation for the Linux input subsystem ("evdev"). | 40 // Ozone events implementation for the Linux input subsystem ("evdev"). |
41 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev | 41 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver, |
42 : public DeviceEventObserver, | 42 public PlatformEventSource { |
43 public PlatformEventSource, | |
44 public DeviceEventDispatcherEvdev { | |
45 public: | 43 public: |
46 EventFactoryEvdev(CursorDelegateEvdev* cursor, | 44 EventFactoryEvdev(CursorDelegateEvdev* cursor, |
47 DeviceManager* device_manager, | 45 DeviceManager* device_manager, |
48 KeyboardLayoutEngine* keyboard_layout_engine); | 46 KeyboardLayoutEngine* keyboard_layout_engine); |
49 ~EventFactoryEvdev() override; | 47 ~EventFactoryEvdev() override; |
50 | 48 |
51 // Initialize. Must be called with a valid message loop. | 49 // Initialize. Must be called with a valid message loop. |
52 void Init(); | 50 void Init(); |
53 | 51 |
54 void WarpCursorTo(gfx::AcceleratedWidget widget, | 52 void WarpCursorTo(gfx::AcceleratedWidget widget, |
55 const gfx::PointF& location); | 53 const gfx::PointF& location); |
56 | 54 |
57 scoped_ptr<SystemInputInjector> CreateSystemInputInjector(); | 55 scoped_ptr<SystemInputInjector> CreateSystemInputInjector(); |
58 | 56 |
59 InputController* input_controller() { return &input_controller_; } | 57 InputController* input_controller() { return &input_controller_; } |
60 | 58 |
61 // DeviceEventDispatchEvdev: | 59 // User input events. |
62 void DispatchKeyEvent(int device_id, unsigned int code, bool down) override; | 60 void DispatchKeyEvent(int device_id, unsigned int code, bool down); |
63 void DispatchMouseMoveEvent(int device_id, | 61 void DispatchMouseMoveEvent(int device_id, const gfx::PointF& location); |
64 const gfx::PointF& location) override; | |
65 void DispatchMouseButtonEvent(int device_id, | 62 void DispatchMouseButtonEvent(int device_id, |
66 const gfx::PointF& location, | 63 const gfx::PointF& location, |
67 unsigned int button, | 64 unsigned int button, |
68 bool down, | 65 bool down, |
69 bool allow_remap) override; | 66 bool allow_remap); |
70 void DispatchMouseWheelEvent(int device_id, | 67 void DispatchMouseWheelEvent(int device_id, |
71 const gfx::PointF& location, | 68 const gfx::PointF& location, |
72 const gfx::Vector2d& delta) override; | 69 const gfx::Vector2d& delta); |
73 void DispatchScrollEvent(const ScrollEventParams& params) override; | 70 void DispatchScrollEvent(const ScrollEventParams& params); |
74 void DispatchTouchEvent(const TouchEventParams& params) override; | 71 void DispatchTouchEvent(const TouchEventParams& params); |
| 72 |
| 73 // Device lifecycle events. |
75 void DispatchKeyboardDevicesUpdated( | 74 void DispatchKeyboardDevicesUpdated( |
76 const std::vector<KeyboardDevice>& devices) override; | 75 const std::vector<KeyboardDevice>& devices); |
77 void DispatchTouchscreenDevicesUpdated( | 76 void DispatchTouchscreenDevicesUpdated( |
78 const std::vector<TouchscreenDevice>& devices) override; | 77 const std::vector<TouchscreenDevice>& devices); |
79 void DispatchMouseDevicesUpdated( | 78 void DispatchMouseDevicesUpdated(const std::vector<InputDevice>& devices); |
80 const std::vector<InputDevice>& devices) override; | 79 void DispatchTouchpadDevicesUpdated(const std::vector<InputDevice>& devices); |
81 void DispatchTouchpadDevicesUpdated( | |
82 const std::vector<InputDevice>& devices) override; | |
83 | 80 |
84 protected: | 81 protected: |
85 // DeviceEventObserver overrides: | 82 // DeviceEventObserver overrides: |
86 // | 83 // |
87 // Callback for device add (on UI thread). | 84 // Callback for device add (on UI thread). |
88 void OnDeviceEvent(const DeviceEvent& event) override; | 85 void OnDeviceEvent(const DeviceEvent& event) override; |
89 | 86 |
90 // PlatformEventSource: | 87 // PlatformEventSource: |
91 void OnDispatcherListChanged() override; | 88 void OnDispatcherListChanged() override; |
92 | 89 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 128 |
132 // Support weak pointers for attach & detach callbacks. | 129 // Support weak pointers for attach & detach callbacks. |
133 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; | 130 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; |
134 | 131 |
135 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); | 132 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); |
136 }; | 133 }; |
137 | 134 |
138 } // namespace ui | 135 } // namespace ui |
139 | 136 |
140 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 137 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
OLD | NEW |