Chromium Code Reviews| Index: ui/events/ozone/evdev/touch_event_converter_evdev.cc |
| diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev.cc b/ui/events/ozone/evdev/touch_event_converter_evdev.cc |
| index c8ff554c2c18d6ef4248336bd0d704f5a0246fea..2b72f7c1689a23e9b3fe7db306c5841556d2dea5 100644 |
| --- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc |
| +++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc |
| @@ -30,10 +30,6 @@ |
| namespace { |
| -// Number is determined empirically. |
| -// TODO(rjkroege): Configure this per device. |
| -const float kFingerWidth = 25.f; |
| - |
| struct TouchCalibration { |
| int bezel_left; |
| int bezel_right; |
| @@ -68,6 +64,10 @@ float TuxelsToPixels(float val, |
| return min_pixels + (val - min_tuxels) * num_pixels / num_tuxels; |
| } |
| +float TuxelToPizelSize(float val, float num_tuxels, float num_pixels) { |
|
alexst (slow to review)
2014/08/26 23:51:26
Pizel Size -> Pizza Size? Pixel Size? :)
|
| + return val * num_pixels / num_tuxels; |
| +} |
| + |
| } // namespace |
| namespace ui { |
| @@ -201,7 +201,16 @@ void TouchEventConverterEvdev::ProcessAbs(const input_event& input) { |
| switch (input.code) { |
| case ABS_MT_TOUCH_MAJOR: |
| altered_slots_.set(current_slot_); |
| - events_[current_slot_].major_ = input.value; |
| + // TODO(spang): If we have all of major, minor, and orientation, |
| + // we can scale the ellipse correctly. However on the Pixel we get |
| + // neither minor nor orientation, so this is all we can do. |
| + events_[current_slot_].radius_x_ = |
| + TuxelToPizelSize(input.value, x_num_tuxels_, x_num_pixels_) / 2.0f; |
| + break; |
| + case ABS_MT_TOUCH_MINOR: |
| + altered_slots_.set(current_slot_); |
| + events_[current_slot_].radius_y_ = |
| + TuxelToPizelSize(input.value, y_num_tuxels_, y_num_pixels_) / 2.0f; |
| break; |
| case ABS_MT_POSITION_X: |
| altered_slots_.set(current_slot_); |
| @@ -286,8 +295,8 @@ void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { |
| /* flags */ 0, |
| /* touch_id */ events_[i].finger_, |
| delta, |
| - events_[i].pressure_ * kFingerWidth, |
| - events_[i].pressure_ * kFingerWidth, |
| + /* radius_x */ events_[i].radius_x_, |
| + /* radius_y */ events_[i].radius_y_, |
| /* angle */ 0., |
| events_[i].pressure_); |
| DispatchEventToCallback(&evt); |