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

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

Issue 1048333005: ozone: Map TouchEvent::touch_id_ into expected range (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Push all touch id management into EventFactoryEvdev Created 5 years, 8 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/event_factory_evdev.cc
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc
index fe2150158d2d816107c222ef6988ced5b29fa0e7..54b3cb6ae43d0726b10a1f84127e4aaf8c02960a 100644
--- a/ui/events/ozone/evdev/event_factory_evdev.cc
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc
@@ -20,6 +20,7 @@
#include "ui/events/ozone/evdev/input_device_factory_evdev.h"
#include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h"
#include "ui/events/ozone/evdev/input_injector_evdev.h"
+#include "ui/events/ozone/evdev/touch_evdev_types.h"
namespace ui {
@@ -121,6 +122,7 @@ EventFactoryEvdev::EventFactoryEvdev(CursorDelegateEvdev* cursor,
cursor_(cursor),
input_controller_(&keyboard_, &button_map_),
initialized_(false),
+ touch_id_generator_(0),
weak_ptr_factory_(this) {
DCHECK(device_manager_);
}
@@ -231,12 +233,19 @@ void EventFactoryEvdev::DispatchTouchEvent(const TouchEventParams& params) {
DeviceDataManager::GetInstance()->ApplyTouchRadiusScale(params.device_id,
&radius_y);
+ // params.slot is guaranteed to be < kNumTouchEvdevSlots.
+ int touch_id = touch_id_generator_.GetGeneratedID(
+ params.device_id * kNumTouchEvdevSlots + params.slot);
TouchEvent touch_event(params.type, gfx::PointF(x, y),
- modifiers_.GetModifierFlags(), params.touch_id,
+ modifiers_.GetModifierFlags(), touch_id,
params.timestamp, radius_x, radius_y,
/* angle */ 0.f, params.pressure);
touch_event.set_source_device_id(params.device_id);
DispatchUiEvent(&touch_event);
+
+ if (params.type == ET_TOUCH_RELEASED || params.type == ET_TOUCH_CANCELLED) {
+ touch_id_generator_.ReleaseGeneratedID(touch_event.touch_id());
+ }
}
void EventFactoryEvdev::DispatchUiEvent(Event* event) {
« no previous file with comments | « ui/events/ozone/evdev/event_factory_evdev.h ('k') | ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698