Index: ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
diff --git a/ui/events/ozone/evdev/tablet_event_converter_evdev.cc b/ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
index 85eebda931069bf8e9007a53134623e0e5b637b0..00fd5070da8bbae16cd1939f034757c420375900 100644 |
--- a/ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
+++ b/ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
@@ -34,6 +34,10 @@ TabletEventConverterEvdev::TabletEventConverterEvdev( |
x_abs_range_ = info.GetAbsMaximum(ABS_X) - x_abs_min_ + 1; |
y_abs_min_ = info.GetAbsMinimum(ABS_Y); |
y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1; |
+ |
+ tilt_x_max_ = info.GetAbsMaximum(ABS_TILT_X); |
+ tilt_y_max_ = info.GetAbsMaximum(ABS_TILT_Y); |
+ pressure_max_ = info.GetAbsMaximum(ABS_PRESSURE); |
} |
TabletEventConverterEvdev::~TabletEventConverterEvdev() { |
@@ -111,6 +115,18 @@ void TabletEventConverterEvdev::ConvertAbsEvent(const input_event& input) { |
y_abs_location_ = input.value; |
abs_value_dirty_ = true; |
break; |
+ case ABS_TILT_X: |
+ tilt_x_ = (90.0f * input.value) / tilt_x_max_; |
+ abs_value_dirty_ = true; |
+ break; |
+ case ABS_TILT_Y: |
+ tilt_y_ = (90.0f * input.value) / tilt_y_max_; |
+ abs_value_dirty_ = true; |
+ break; |
+ case ABS_PRESSURE: |
+ pressure_ = (float)input.value / pressure_max_; |
+ abs_value_dirty_ = true; |
+ break; |
} |
} |
@@ -152,7 +168,11 @@ void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) { |
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams( |
input_device_.id, cursor_->GetLocation(), button, down, |
- false /* allow_remap */, TimeDeltaFromInputEvent(input))); |
+ false /* allow_remap */, |
+ PointerDetails(EventPointerType::POINTER_TYPE_PEN, |
+ /* radius_x */ 0.0f, /* radius_y */ 0.0f, pressure_, |
+ tilt_x_, tilt_y_), |
+ TimeDeltaFromInputEvent(input))); |
} |
void TabletEventConverterEvdev::FlushEvents(const input_event& input) { |
@@ -170,9 +190,12 @@ void TabletEventConverterEvdev::FlushEvents(const input_event& input) { |
UpdateCursor(); |
- dispatcher_->DispatchMouseMoveEvent( |
- MouseMoveEventParams(input_device_.id, cursor_->GetLocation(), |
- TimeDeltaFromInputEvent(input))); |
+ dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( |
+ input_device_.id, cursor_->GetLocation(), |
+ PointerDetails(EventPointerType::POINTER_TYPE_PEN, |
+ /* radius_x */ 0.0f, /* radius_y */ 0.0f, pressure_, |
+ tilt_x_, tilt_y_), |
+ TimeDeltaFromInputEvent(input))); |
abs_value_dirty_ = false; |
} |