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

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

Issue 867803004: [PATCH 4/11] ozone: evdev: Move EventModifiersEvdev usage to EventFactoryEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update per comments on previous patches Created 5 years, 11 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 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;
}
« no previous file with comments | « ui/events/ozone/evdev/tablet_event_converter_evdev.h ('k') | ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698