Commit 5c979b9b authored by Harry Cutts's avatar Harry Cutts Committed by Commit Bot

ozone: evdev: Use pointing stick classification from libevdev

This allows pointing sticks to have different gesture properties than
normal mice, though at the moment the same properties are set for both.
See go/cros-pointing-stick-settings (Googlers only, sorry) for the
design doc.

Bug: 1114828
Test: check that pointing sticks and mice behave as normal
Cq-Depend: chromium:2465650
Change-Id: If7837f530fbeb0a4029674d4c4c81e66630bbb0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2486866
Commit-Queue: Harry Cutts <hcutts@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826538}
parent 247e78f7
......@@ -37,6 +37,7 @@ namespace ui {
enum COMPONENT_EXPORT(EVDEV) EventDeviceType {
DT_KEYBOARD,
DT_MOUSE,
DT_POINTING_STICK,
DT_TOUCHPAD,
DT_TOUCHSCREEN,
DT_MULTITOUCH,
......
......@@ -342,20 +342,8 @@ void InputDeviceFactoryEvdev::ApplyInputDeviceSettings() {
SetBoolPropertyForOneType(DT_MULTITOUCH, "Australian Scrolling",
input_device_settings_.natural_scroll_enabled);
SetIntPropertyForOneType(DT_MOUSE, "Pointer Sensitivity",
input_device_settings_.mouse_sensitivity);
SetIntPropertyForOneType(DT_MOUSE, "Mouse Scroll Sensitivity",
input_device_settings_.mouse_scroll_sensitivity);
SetBoolPropertyForOneType(DT_MOUSE, "Pointer Acceleration",
input_device_settings_.mouse_acceleration_enabled);
SetBoolPropertyForOneType(
DT_MOUSE, "Mouse Scroll Acceleration",
input_device_settings_.mouse_scroll_acceleration_enabled);
SetBoolPropertyForOneType(
DT_MOUSE, "Mouse Reverse Scrolling",
input_device_settings_.mouse_reverse_scroll_enabled);
SetBoolPropertyForOneType(DT_MOUSE, "Mouse High Resolution Scrolling", true);
SetBoolPropertyForOneType(DT_MOUSE, "Output Mouse Wheel Gestures", true);
ApplyRelativePointingDeviceSettings(DT_MOUSE);
ApplyRelativePointingDeviceSettings(DT_POINTING_STICK);
SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused",
input_device_settings_.tap_to_click_paused);
......@@ -387,6 +375,24 @@ void InputDeviceFactoryEvdev::ApplyInputDeviceSettings() {
NotifyDevicesUpdated();
}
void InputDeviceFactoryEvdev::ApplyRelativePointingDeviceSettings(
EventDeviceType type) {
SetIntPropertyForOneType(type, "Pointer Sensitivity",
input_device_settings_.mouse_sensitivity);
SetIntPropertyForOneType(type, "Mouse Scroll Sensitivity",
input_device_settings_.mouse_scroll_sensitivity);
SetBoolPropertyForOneType(type, "Pointer Acceleration",
input_device_settings_.mouse_acceleration_enabled);
SetBoolPropertyForOneType(
type, "Mouse Scroll Acceleration",
input_device_settings_.mouse_scroll_acceleration_enabled);
SetBoolPropertyForOneType(
type, "Mouse Reverse Scrolling",
input_device_settings_.mouse_reverse_scroll_enabled);
SetBoolPropertyForOneType(type, "Mouse High Resolution Scrolling", true);
SetBoolPropertyForOneType(type, "Output Mouse Wheel Gestures", true);
}
void InputDeviceFactoryEvdev::ApplyCapsLockLed() {
for (const auto& it : converters_) {
EventConverterEvdev* converter = it.second.get();
......
......@@ -86,6 +86,7 @@ class COMPONENT_EXPORT(EVDEV) InputDeviceFactoryEvdev {
// Sync input_device_settings_ to attached devices.
void ApplyInputDeviceSettings();
void ApplyRelativePointingDeviceSettings(EventDeviceType type);
void ApplyCapsLockLed();
// Policy for device enablement.
......
......@@ -38,6 +38,8 @@ GestureInterpreterDeviceClass GestureDeviceClass(Evdev* evdev) {
switch (evdev->info.evdev_class) {
case EvdevClassMouse:
return GESTURES_DEVCLASS_MOUSE;
case EvdevClassPointingStick:
return GESTURES_DEVCLASS_POINTING_STICK;
case EvdevClassMultitouchMouse:
return GESTURES_DEVCLASS_MULTITOUCH_MOUSE;
case EvdevClassTouchpad:
......@@ -144,6 +146,8 @@ void GestureInterpreterLibevdevCros::OnLibEvdevCrosOpen(
GestureHardwareProperties(evdev, device_properties_.get());
GestureInterpreterDeviceClass devclass = GestureDeviceClass(evdev);
is_mouse_ = property_provider_->IsDeviceIdOfType(id_, DT_MOUSE);
is_pointing_stick_ =
property_provider_->IsDeviceIdOfType(id_, DT_POINTING_STICK);
// Create & initialize GestureInterpreter.
DCHECK(!interpreter_);
......@@ -519,7 +523,7 @@ void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int button,
if (!SetMouseButtonState(button, down))
return; // No change.
bool allow_remap = is_mouse_;
bool allow_remap = is_mouse_ || is_pointing_stick_;
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
id_, EF_NONE, cursor_->GetLocation(), button, down, allow_remap,
PointerDetails(EventPointerType::kMouse), StimeToTimeTicks(time)));
......
......@@ -99,6 +99,7 @@ class COMPONENT_EXPORT(EVDEV) GestureInterpreterLibevdevCros
// True if the device may be regarded as a mouse. This includes normal mice
// and multi-touch mice.
bool is_mouse_ = false;
bool is_pointing_stick_ = false;
// Shared cursor state.
CursorDelegateEvdev* cursor_;
......
......@@ -450,6 +450,8 @@ bool IsDeviceOfType(const ui::GesturePropertyProvider::DevicePtr device,
return (evdev_class == EvdevClassKeyboard);
case ui::DT_MOUSE:
return is_mouse;
case ui::DT_POINTING_STICK:
return (evdev_class == EvdevClassPointingStick);
case ui::DT_TOUCHPAD:
return (!is_mouse) && is_touchpad;
case ui::DT_TOUCHSCREEN:
......@@ -809,6 +811,7 @@ bool MatchIsPointer::Match(const DevicePtr device) {
if (!is_valid_)
return true;
return (value_ == (device->info.evdev_class == EvdevClassMouse ||
device->info.evdev_class == EvdevClassPointingStick ||
device->info.evdev_class == EvdevClassMultitouchMouse));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment