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

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

Issue 1294523004: ozone: Handle pressure and tilt for stylus devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-pe-details
Patch Set: Address spang@ feedback Created 5 years, 4 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/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..6e65820b093967d93747338eab44c477dcf79fbe 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,8 @@ 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 */, EventPointerType::POINTER_TYPE_PEN, pressure_,
+ tilt_x_, tilt_y_, TimeDeltaFromInputEvent(input)));
}
void TabletEventConverterEvdev::FlushEvents(const input_event& input) {
@@ -172,7 +189,8 @@ void TabletEventConverterEvdev::FlushEvents(const input_event& input) {
dispatcher_->DispatchMouseMoveEvent(
MouseMoveEventParams(input_device_.id, cursor_->GetLocation(),
- TimeDeltaFromInputEvent(input)));
+ EventPointerType::POINTER_TYPE_PEN, pressure_,
+ tilt_x_, tilt_y_, TimeDeltaFromInputEvent(input)));
abs_value_dirty_ = false;
}

Powered by Google App Engine
This is Rietveld 408576698