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

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

Issue 868213002: [PATCH 7/11] ozone: evdev: Move GesturePropertyProvider to InputDeviceFactoryEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates for events_unittests Created 5 years, 11 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: ui/events/ozone/evdev/input_controller_evdev.cc
diff --git a/ui/events/ozone/evdev/input_controller_evdev.cc b/ui/events/ozone/evdev/input_controller_evdev.cc
index 8f135530f0f90670a7d34e2efddbdbb6921e27c8..35887421014e315deb7ea3b383c731e701c305a4 100644
--- a/ui/events/ozone/evdev/input_controller_evdev.cc
+++ b/ui/events/ozone/evdev/input_controller_evdev.cc
@@ -11,56 +11,13 @@
#include "ui/events/ozone/evdev/keyboard_evdev.h"
#include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
-#if defined(USE_EVDEV_GESTURES)
-#include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h"
-#endif
-
namespace ui {
-namespace {
-
-#if defined(USE_EVDEV_GESTURES)
-void SetGestureIntProperty(GesturePropertyProvider* provider,
- int id,
- const std::string& name,
- int value) {
- GesturesProp* property = provider->GetProperty(id, name);
- if (property) {
- std::vector<int> values(1, value);
- property->SetIntValue(values);
- }
-}
-
-void SetGestureBoolProperty(GesturePropertyProvider* provider,
- int id,
- const std::string& name,
- bool value) {
- GesturesProp* property = provider->GetProperty(id, name);
- if (property) {
- std::vector<bool> values(1, value);
- property->SetBoolValue(values);
- }
-}
-#endif
-
-} // namespace
-
-InputControllerEvdev::InputControllerEvdev(
- KeyboardEvdev* keyboard,
- MouseButtonMapEvdev* button_map
-#if defined(USE_EVDEV_GESTURES)
- ,
- GesturePropertyProvider* gesture_property_provider
-#endif
- )
+InputControllerEvdev::InputControllerEvdev(KeyboardEvdev* keyboard,
+ MouseButtonMapEvdev* button_map)
: input_device_factory_(nullptr),
keyboard_(keyboard),
- button_map_(button_map)
-#if defined(USE_EVDEV_GESTURES)
- ,
- gesture_property_provider_(gesture_property_provider)
-#endif
-{
+ button_map_(button_map) {
}
InputControllerEvdev::~InputControllerEvdev() {
@@ -74,13 +31,13 @@ void InputControllerEvdev::SetInputDeviceFactory(
bool InputControllerEvdev::HasMouse() {
if (!input_device_factory_)
return false;
- return input_device_factory_->GetDeviceIdsByType(DT_MOUSE, NULL);
+ return input_device_factory_->HasMouse();
}
bool InputControllerEvdev::HasTouchpad() {
if (!input_device_factory_)
return false;
- return input_device_factory_->GetDeviceIdsByType(DT_TOUCHPAD, NULL);
+ return input_device_factory_->HasTouchpad();
}
bool InputControllerEvdev::IsCapsLockEnabled() {
@@ -135,62 +92,34 @@ void InputControllerEvdev::EnableInternalKeyboard() {
input_device_factory_->EnableInternalKeyboard();
}
-void InputControllerEvdev::SetIntPropertyForOneType(const EventDeviceType type,
- const std::string& name,
- int value) {
- if (!input_device_factory_)
- return;
-#if defined(USE_EVDEV_GESTURES)
- std::vector<int> ids;
- input_device_factory_->GetDeviceIdsByType(type, &ids);
- for (size_t i = 0; i < ids.size(); ++i) {
- SetGestureIntProperty(gesture_property_provider_, ids[i], name, value);
- }
-#endif
- // In the future, we may add property setting codes for other non-gesture
- // devices. One example would be keyboard settings.
- // TODO(sheckylin): See http://crbug.com/398518 for example.
-}
-
-void InputControllerEvdev::SetBoolPropertyForOneType(const EventDeviceType type,
- const std::string& name,
- bool value) {
- if (!input_device_factory_)
- return;
-#if defined(USE_EVDEV_GESTURES)
- std::vector<int> ids;
- input_device_factory_->GetDeviceIdsByType(type, &ids);
- for (size_t i = 0; i < ids.size(); ++i) {
- SetGestureBoolProperty(gesture_property_provider_, ids[i], name, value);
- }
-#endif
-}
-
void InputControllerEvdev::SetTouchpadSensitivity(int value) {
- SetIntPropertyForOneType(DT_TOUCHPAD, "Pointer Sensitivity", value);
- SetIntPropertyForOneType(DT_TOUCHPAD, "Scroll Sensitivity", value);
+ if (input_device_factory_)
+ input_device_factory_->SetTouchpadSensitivity(value);
}
void InputControllerEvdev::SetTapToClick(bool enabled) {
- SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Enable", enabled);
+ if (input_device_factory_)
+ input_device_factory_->SetTapToClick(enabled);
}
void InputControllerEvdev::SetThreeFingerClick(bool enabled) {
- SetBoolPropertyForOneType(DT_TOUCHPAD, "T5R2 Three Finger Click Enable",
- enabled);
+ if (input_device_factory_)
+ input_device_factory_->SetThreeFingerClick(enabled);
}
void InputControllerEvdev::SetTapDragging(bool enabled) {
- SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Drag Enable", enabled);
+ if (input_device_factory_)
+ input_device_factory_->SetTapDragging(enabled);
}
void InputControllerEvdev::SetNaturalScroll(bool enabled) {
- SetBoolPropertyForOneType(DT_MULTITOUCH, "Australian Scrolling", enabled);
+ if (input_device_factory_)
+ input_device_factory_->SetNaturalScroll(enabled);
}
void InputControllerEvdev::SetMouseSensitivity(int value) {
- SetIntPropertyForOneType(DT_MOUSE, "Pointer Sensitivity", value);
- SetIntPropertyForOneType(DT_MOUSE, "Scroll Sensitivity", value);
+ if (input_device_factory_)
+ input_device_factory_->SetMouseSensitivity(value);
}
void InputControllerEvdev::SetPrimaryButtonRight(bool right) {
@@ -199,7 +128,8 @@ void InputControllerEvdev::SetPrimaryButtonRight(bool right) {
}
void InputControllerEvdev::SetTapToClickPaused(bool state) {
- SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused", state);
+ if (input_device_factory_)
+ input_device_factory_->SetTapToClickPaused(state);
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698