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

Unified Diff: services/ui/public/cpp/input_devices/input_device_client.cc

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Created 3 years, 8 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
Index: services/ui/public/cpp/input_devices/input_device_client.cc
diff --git a/services/ui/public/cpp/input_devices/input_device_client.cc b/services/ui/public/cpp/input_devices/input_device_client.cc
index 07593c1ded8fb0baad2d0b3b6e9276c410fb9299..f5aab95eacf9821de21229e84b77619a30b3c98a 100644
--- a/services/ui/public/cpp/input_devices/input_device_client.cc
+++ b/services/ui/public/cpp/input_devices/input_device_client.cc
@@ -39,6 +39,11 @@ const std::vector<ui::InputDevice>& InputDeviceClient::GetTouchpadDevices()
return touchpad_devices_;
}
+const std::vector<ui::InputDevice>& InputDeviceClient::GetGamepadDevices()
+ const {
+ return gamepad_devices_;
+}
+
bool InputDeviceClient::AreDeviceListsComplete() const {
return device_lists_complete_;
}
@@ -95,11 +100,19 @@ void InputDeviceClient::OnTouchpadDeviceConfigurationChanged(
observer.OnTouchpadDeviceConfigurationChanged();
}
+void InputDeviceClient::OnGamepadDeviceConfigurationChanged(
+ const std::vector<ui::InputDevice>& devices) {
+ gamepad_devices_ = devices;
+ for (auto& observer : observers_)
+ observer.OnGamepadDeviceConfigurationChanged();
+}
+
void InputDeviceClient::OnDeviceListsComplete(
const std::vector<ui::InputDevice>& keyboard_devices,
const std::vector<ui::TouchscreenDevice>& touchscreen_devices,
const std::vector<ui::InputDevice>& mouse_devices,
- const std::vector<ui::InputDevice>& touchpad_devices) {
+ const std::vector<ui::InputDevice>& touchpad_devices,
+ const std::vector<ui::InputDevice>& gamepad_devices) {
// Update the cached device lists if the received list isn't empty.
if (!keyboard_devices.empty())
OnKeyboardDeviceConfigurationChanged(keyboard_devices);
@@ -109,6 +122,8 @@ void InputDeviceClient::OnDeviceListsComplete(
OnMouseDeviceConfigurationChanged(mouse_devices);
if (!touchpad_devices.empty())
OnTouchpadDeviceConfigurationChanged(touchpad_devices);
+ if (!gamepad_devices_.empty())
+ OnGamepadDeviceConfigurationChanged(gamepad_devices_);
if (!device_lists_complete_) {
device_lists_complete_ = true;

Powered by Google App Engine
This is Rietveld 408576698