| Index: ui/events/ozone/evdev/input_device_factory_evdev.cc
|
| diff --git a/ui/events/ozone/evdev/input_device_factory_evdev.cc b/ui/events/ozone/evdev/input_device_factory_evdev.cc
|
| index 6812283e9513478eb2b3c8a3d2d1deca6fa568d2..d6efeb80dbcb33b41dbc413b251650c87409787d 100644
|
| --- a/ui/events/ozone/evdev/input_device_factory_evdev.cc
|
| +++ b/ui/events/ozone/evdev/input_device_factory_evdev.cc
|
| @@ -20,8 +20,10 @@
|
| #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
|
| #include "ui/events/ozone/evdev/event_converter_evdev_impl.h"
|
| #include "ui/events/ozone/evdev/event_device_info.h"
|
| +#include "ui/events/ozone/evdev/gamepad_event_converter_evdev.h"
|
| #include "ui/events/ozone/evdev/tablet_event_converter_evdev.h"
|
| #include "ui/events/ozone/evdev/touch_event_converter_evdev.h"
|
| +#include "ui/events/ozone/gamepad/gamepad_provider_ozone.h"
|
|
|
| #if defined(USE_EVDEV_GESTURES)
|
| #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h"
|
| @@ -113,6 +115,11 @@ std::unique_ptr<EventConverterEvdev> CreateConverter(
|
| std::move(fd), params.path, params.id, params.cursor, devinfo,
|
| params.dispatcher));
|
|
|
| + if (devinfo.HasGamepad()) {
|
| + return base::WrapUnique<EventConverterEvdev>(new GamepadEventConverterEvdev(
|
| + std::move(fd), params.path, params.id, devinfo, params.dispatcher));
|
| + }
|
| +
|
| // Everything else: use EventConverterEvdevImpl.
|
| return base::WrapUnique<EventConverterEvdevImpl>(
|
| new EventConverterEvdevImpl(std::move(fd), params.path, params.id,
|
| @@ -367,6 +374,9 @@ void InputDeviceFactoryEvdev::UpdateDirtyFlags(
|
|
|
| if (converter->HasTouchpad())
|
| touchpad_list_dirty_ = true;
|
| +
|
| + if (converter->HasGamepad())
|
| + gamepad_list_dirty_ = true;
|
| }
|
|
|
| void InputDeviceFactoryEvdev::NotifyDevicesUpdated() {
|
| @@ -380,6 +390,8 @@ void InputDeviceFactoryEvdev::NotifyDevicesUpdated() {
|
| NotifyMouseDevicesUpdated();
|
| if (touchpad_list_dirty_)
|
| NotifyTouchpadDevicesUpdated();
|
| + if (gamepad_list_dirty_)
|
| + NotifyGamepadDevicesUpdated();
|
| if (!startup_devices_opened_) {
|
| dispatcher_->DispatchDeviceListsComplete();
|
| startup_devices_opened_ = true;
|
| @@ -388,6 +400,7 @@ void InputDeviceFactoryEvdev::NotifyDevicesUpdated() {
|
| keyboard_list_dirty_ = false;
|
| mouse_list_dirty_ = false;
|
| touchpad_list_dirty_ = false;
|
| + gamepad_list_dirty_ = false;
|
| }
|
|
|
| void InputDeviceFactoryEvdev::NotifyTouchscreensUpdated() {
|
| @@ -438,6 +451,17 @@ void InputDeviceFactoryEvdev::NotifyTouchpadDevicesUpdated() {
|
| dispatcher_->DispatchTouchpadDevicesUpdated(touchpads);
|
| }
|
|
|
| +void InputDeviceFactoryEvdev::NotifyGamepadDevicesUpdated() {
|
| + std::vector<InputDevice> gamepads;
|
| + for (auto it = converters_.begin(); it != converters_.end(); ++it) {
|
| + if (it->second->HasGamepad()) {
|
| + gamepads.push_back(it->second->input_device());
|
| + }
|
| + }
|
| +
|
| + dispatcher_->DispatchGamepadDevicesUpdated(gamepads);
|
| +}
|
| +
|
| void InputDeviceFactoryEvdev::SetIntPropertyForOneType(
|
| const EventDeviceType type,
|
| const std::string& name,
|
|
|