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 58dafb931298dbd787936cd77f758dde4b0badb6..c1759756f11f7758b1f4c854298d8ee9bedc8143 100644 |
--- a/ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
+++ b/ui/events/ozone/evdev/tablet_event_converter_evdev.cc |
@@ -17,14 +17,14 @@ TabletEventConverterEvdev::TabletEventConverterEvdev( |
base::FilePath path, |
int id, |
InputDeviceType type, |
- EventModifiersEvdev* modifiers, |
CursorDelegateEvdev* cursor, |
const EventDeviceInfo& info, |
- const EventDispatchCallback& callback) |
+ const MouseMoveEventDispatchCallback& mouse_move_callback, |
+ const MouseButtonEventDispatchCallback& mouse_button_callback) |
: EventConverterEvdev(fd, path, id, type), |
cursor_(cursor), |
- modifiers_(modifiers), |
- callback_(callback), |
+ mouse_move_callback_(mouse_move_callback), |
+ mouse_button_callback_(mouse_button_callback), |
stylus_(0), |
abs_value_dirty_(false) { |
x_abs_min_ = info.GetAbsMinimum(ABS_X); |
@@ -127,14 +127,14 @@ void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) { |
if (!cursor_) |
return; |
- unsigned int modifier; |
+ unsigned int button; |
// These are the same as X11 behaviour |
if (input.code == BTN_TOUCH) |
- modifier = EVDEV_MODIFIER_LEFT_MOUSE_BUTTON; |
+ button = BTN_LEFT; |
else if (input.code == BTN_STYLUS2) |
- modifier = EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON; |
+ button = BTN_RIGHT; |
else if (input.code == BTN_STYLUS) |
- modifier = EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON; |
+ button = BTN_MIDDLE; |
else |
return; |
@@ -143,12 +143,10 @@ void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) { |
abs_value_dirty_ = false; |
} |
- int flag = modifiers_->GetEventFlagFromModifier(modifier); |
- modifiers_->UpdateModifier(modifier, input.value); |
- callback_.Run(make_scoped_ptr( |
- new MouseEvent(input.value ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED, |
- cursor_->GetLocation(), cursor_->GetLocation(), |
- modifiers_->GetModifierFlags() | flag, flag))); |
+ bool down = input.value; |
+ |
+ mouse_button_callback_.Run(MouseButtonEventParams( |
+ id_, cursor_->GetLocation(), button, down, false /* allow_remap */)); |
} |
void TabletEventConverterEvdev::FlushEvents() { |
@@ -166,10 +164,7 @@ void TabletEventConverterEvdev::FlushEvents() { |
UpdateCursor(); |
- callback_.Run(make_scoped_ptr( |
- new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->GetLocation(), |
- cursor_->GetLocation(), modifiers_->GetModifierFlags(), |
- /* changed_button_flags */ 0))); |
+ mouse_move_callback_.Run(MouseMoveEventParams(id_, cursor_->GetLocation())); |
abs_value_dirty_ = false; |
} |