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

Side by Side Diff: ui/events/ozone/evdev/event_factory_evdev.h

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Support Gamepad in Ozone. Created 3 years, 7 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
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_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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/task_runner.h" 13 #include "base/task_runner.h"
14 #include "ui/events/ozone/device/device_event_observer.h" 14 #include "ui/events/ozone/device/device_event_observer.h"
15 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" 15 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
16 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" 16 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
17 #include "ui/events/ozone/evdev/event_thread_evdev.h" 17 #include "ui/events/ozone/evdev/event_thread_evdev.h"
18 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 18 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
19 #include "ui/events/ozone/evdev/input_controller_evdev.h" 19 #include "ui/events/ozone/evdev/input_controller_evdev.h"
20 #include "ui/events/ozone/evdev/keyboard_evdev.h" 20 #include "ui/events/ozone/evdev/keyboard_evdev.h"
21 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" 21 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
22 #include "ui/events/ozone/gamepad/gamepad_event.h"
22 #include "ui/events/platform/platform_event_source.h" 23 #include "ui/events/platform/platform_event_source.h"
23 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/sequential_id_generator.h" 25 #include "ui/gfx/sequential_id_generator.h"
25 #include "ui/ozone/public/system_input_injector.h" 26 #include "ui/ozone/public/system_input_injector.h"
26 27
27 namespace gfx { 28 namespace gfx {
28 class PointF; 29 class PointF;
29 } // namespace gfx 30 } // namespace gfx
30 31
31 namespace ui { 32 namespace ui {
32 33
33 class CursorDelegateEvdev; 34 class CursorDelegateEvdev;
34 class DeviceManager; 35 class DeviceManager;
35 class InputDeviceFactoryEvdev; 36 class InputDeviceFactoryEvdev;
36 class InputDeviceFactoryEvdevProxy; 37 class InputDeviceFactoryEvdevProxy;
37 class SystemInputInjector; 38 class SystemInputInjector;
39 class GamepadProviderOzone;
38 enum class DomCode; 40 enum class DomCode;
39 enum class StylusState; 41 enum class StylusState;
40 42
41 #if !defined(USE_EVDEV) 43 #if !defined(USE_EVDEV)
42 #error Missing dependency on ui/events/ozone:events_ozone_evdev 44 #error Missing dependency on ui/events/ozone:events_ozone_evdev
43 #endif 45 #endif
44 46
45 // Ozone events implementation for the Linux input subsystem ("evdev"). 47 // Ozone events implementation for the Linux input subsystem ("evdev").
46 // 48 //
47 // This is a UI thread object, but creates its own thread for I/O. See 49 // This is a UI thread object, but creates its own thread for I/O. See
(...skipping 27 matching lines...) Expand all
75 77
76 // Device lifecycle events. 78 // Device lifecycle events.
77 void DispatchKeyboardDevicesUpdated(const std::vector<InputDevice>& devices); 79 void DispatchKeyboardDevicesUpdated(const std::vector<InputDevice>& devices);
78 void DispatchTouchscreenDevicesUpdated( 80 void DispatchTouchscreenDevicesUpdated(
79 const std::vector<TouchscreenDevice>& devices); 81 const std::vector<TouchscreenDevice>& devices);
80 void DispatchMouseDevicesUpdated(const std::vector<InputDevice>& devices); 82 void DispatchMouseDevicesUpdated(const std::vector<InputDevice>& devices);
81 void DispatchTouchpadDevicesUpdated(const std::vector<InputDevice>& devices); 83 void DispatchTouchpadDevicesUpdated(const std::vector<InputDevice>& devices);
82 void DispatchDeviceListsComplete(); 84 void DispatchDeviceListsComplete();
83 void DispatchStylusStateChanged(StylusState stylus_state); 85 void DispatchStylusStateChanged(StylusState stylus_state);
84 86
87 // Gamepad event and gamepad device event. These events are dispatched to
88 // GamepadObserver through GamepadProviderOzone.
89 void DispatchGamepadEvent(const GamepadEvent& event);
90 void DispatchGamepadDevicesUpdated(const std::vector<InputDevice>& devices);
91
85 protected: 92 protected:
86 // DeviceEventObserver overrides: 93 // DeviceEventObserver overrides:
87 // 94 //
88 // Callback for device add (on UI thread). 95 // Callback for device add (on UI thread).
89 void OnDeviceEvent(const DeviceEvent& event) override; 96 void OnDeviceEvent(const DeviceEvent& event) override;
90 97
91 // PlatformEventSource: 98 // PlatformEventSource:
92 void OnDispatcherListChanged() override; 99 void OnDispatcherListChanged() override;
93 100
94 private: 101 private:
95 // Dispatch event via PlatformEventSource. 102 // Dispatch event via PlatformEventSource.
96 void DispatchUiEvent(ui::Event* event); 103 void DispatchUiEvent(ui::Event* event);
97 104
98 int NextDeviceId(); 105 int NextDeviceId();
99 106
100 // Device thread initialization. 107 // Device thread initialization.
101 void StartThread(); 108 void StartThread();
102 void OnThreadStarted( 109 void OnThreadStarted(
103 std::unique_ptr<InputDeviceFactoryEvdevProxy> input_device_factory); 110 std::unique_ptr<InputDeviceFactoryEvdevProxy> input_device_factory);
104 111
105 // Used to uniquely identify input devices. 112 // Used to uniquely identify input devices.
106 int last_device_id_ = 0; 113 int last_device_id_ = 0;
107 114
108 // Interface for scanning & monitoring input devices. 115 // Interface for scanning & monitoring input devices.
109 DeviceManager* device_manager_; // Not owned. 116 DeviceManager* device_manager_; // Not owned.
110 117
118 // Gamepad provider to dispatch gamepad events.
119 GamepadProviderOzone* gamepad_provider_;
120
111 // Proxy for input device factory (manages device I/O objects). 121 // Proxy for input device factory (manages device I/O objects).
112 // The real object lives on a different thread. 122 // The real object lives on a different thread.
113 std::unique_ptr<InputDeviceFactoryEvdevProxy> input_device_factory_proxy_; 123 std::unique_ptr<InputDeviceFactoryEvdevProxy> input_device_factory_proxy_;
114 124
115 // Modifier key state (shift, ctrl, etc). 125 // Modifier key state (shift, ctrl, etc).
116 EventModifiersEvdev modifiers_; 126 EventModifiersEvdev modifiers_;
117 127
118 // Mouse button map. 128 // Mouse button map.
119 MouseButtonMapEvdev button_map_; 129 MouseButtonMapEvdev button_map_;
120 130
(...skipping 17 matching lines...) Expand all
138 148
139 // Support weak pointers for attach & detach callbacks. 149 // Support weak pointers for attach & detach callbacks.
140 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; 150 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_;
141 151
142 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); 152 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev);
143 }; 153 };
144 154
145 } // namespace ui 155 } // namespace ui
146 156
147 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ 157 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_device_test_util.cc ('k') | ui/events/ozone/evdev/event_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698