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

Unified Diff: ui/events/ozone/evdev/event_factory_evdev.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/ozone/evdev/event_factory_evdev.h ('k') | ui/events/ozone/evdev/gamepad_event_converter_evdev.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/event_factory_evdev.cc
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc
index 00b1881920cc711cd5bbd8eec6ae95604a9c32d6..ad7bdf8df7de645b4c864c6ca997d05ff5fad154 100644
--- a/ui/events/ozone/evdev/event_factory_evdev.cc
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc
@@ -24,6 +24,7 @@
#include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h"
#include "ui/events/ozone/evdev/input_injector_evdev.h"
#include "ui/events/ozone/evdev/touch_evdev_types.h"
+#include "ui/events/ozone/gamepad/gamepad_provider_ozone.h"
namespace ui {
@@ -84,6 +85,12 @@ class ProxyDeviceEventDispatcher : public DeviceEventDispatcherEvdev {
event_factory_evdev_, params));
}
+ void DispatchGamepadEvent(const GamepadEvent& event) override {
+ ui_thread_runner_->PostTask(
+ FROM_HERE, base::Bind(&EventFactoryEvdev::DispatchGamepadEvent,
+ event_factory_evdev_, event));
+ }
+
void DispatchKeyboardDevicesUpdated(
const std::vector<InputDevice>& devices) override {
ui_thread_runner_->PostTask(
@@ -123,6 +130,13 @@ class ProxyDeviceEventDispatcher : public DeviceEventDispatcherEvdev {
event_factory_evdev_, stylus_state));
}
+ void DispatchGamepadDevicesUpdated(
+ const std::vector<InputDevice>& devices) override {
+ ui_thread_runner_->PostTask(
+ FROM_HERE, base::Bind(&EventFactoryEvdev::DispatchGamepadDevicesUpdated,
+ event_factory_evdev_, devices));
+ }
+
private:
scoped_refptr<base::SingleThreadTaskRunner> ui_thread_runner_;
base::WeakPtr<EventFactoryEvdev> event_factory_evdev_;
@@ -160,6 +174,7 @@ EventFactoryEvdev::EventFactoryEvdev(CursorDelegateEvdev* cursor,
DeviceManager* device_manager,
KeyboardLayoutEngine* keyboard_layout)
: device_manager_(device_manager),
+ gamepad_provider_(GamepadProviderOzone::GetInstance()),
keyboard_(&modifiers_,
keyboard_layout,
base::Bind(&EventFactoryEvdev::DispatchUiEvent,
@@ -346,6 +361,10 @@ void EventFactoryEvdev::DispatchTouchEvent(const TouchEventParams& params) {
}
}
+void EventFactoryEvdev::DispatchGamepadEvent(const GamepadEvent& event) {
+ gamepad_provider_->DispatchGamepadEvent(event);
+}
+
void EventFactoryEvdev::DispatchUiEvent(Event* event) {
// DispatchEvent takes PlatformEvent which is void*. This function
// wraps it with the real type.
@@ -398,6 +417,12 @@ void EventFactoryEvdev::DispatchStylusStateChanged(StylusState stylus_state) {
observer->OnStylusStateChanged(stylus_state);
};
+void EventFactoryEvdev::DispatchGamepadDevicesUpdated(
+ const std::vector<InputDevice>& devices) {
+ TRACE_EVENT0("evdev", "EventFactoryEvdev::DispatchGamepadDevicesUpdated");
+ gamepad_provider_->DispatchGamepadDevicesUpdated(devices);
+}
+
void EventFactoryEvdev::OnDeviceEvent(const DeviceEvent& event) {
if (event.device_type() != DeviceEvent::INPUT)
return;
« no previous file with comments | « ui/events/ozone/evdev/event_factory_evdev.h ('k') | ui/events/ozone/evdev/gamepad_event_converter_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698