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 2ba5a7e2d4b90420969208cb071405d7ea5c8dd4..869520f2f276f934fff486ac65886103fbf7eeb3 100644 |
--- a/ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
+++ b/ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
@@ -22,6 +22,12 @@ float ScaleTilt(int value, int min_value, int num_values) { |
return 180.f * (value - min_value) / num_values - 90.f; |
} |
+EventPointerType GetToolType(int button_tool) { |
+ if (button_tool == BTN_TOOL_RUBBER) |
+ return EventPointerType::POINTER_TYPE_ERASER; |
+ return EventPointerType::POINTER_TYPE_PEN; |
+} |
+ |
} // namespace |
TabletEventConverterEvdev::TabletEventConverterEvdev( |
@@ -180,7 +186,7 @@ void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) { |
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams( |
input_device_.id, EF_NONE, cursor_->GetLocation(), button, down, |
false /* allow_remap */, |
- PointerDetails(EventPointerType::POINTER_TYPE_PEN, |
+ PointerDetails(GetToolType(stylus_), |
/* radius_x */ 0.0f, /* radius_y */ 0.0f, pressure_, |
tilt_x_, tilt_y_), |
TimeTicksFromInputEvent(input))); |
@@ -203,7 +209,7 @@ void TabletEventConverterEvdev::FlushEvents(const input_event& input) { |
dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( |
input_device_.id, EF_NONE, cursor_->GetLocation(), |
- PointerDetails(EventPointerType::POINTER_TYPE_PEN, |
+ PointerDetails(GetToolType(stylus_), |
/* radius_x */ 0.0f, /* radius_y */ 0.0f, pressure_, |
tilt_x_, tilt_y_), |
TimeTicksFromInputEvent(input))); |