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

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

Issue 2640163003: ozone: Cancel all touches once a single touch is cancelled (Closed)
Patch Set: added TODO note Created 3 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
« no previous file with comments | « ui/events/ozone/evdev/touch_event_converter_evdev.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c46608d938577b8a3ec79c290e71ab7be7ddf89b..fd57301dd96c13cd514b14324be83f5b2ce712e9 100644
--- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
@@ -167,7 +167,7 @@ void TouchEventConverterEvdev::Initialize(const EventDeviceInfo& info) {
// TODO(denniskempin): Use EVIOCGKEY to synchronize key state.
events_.resize(touch_points_);
-
+ bool cancelled_state = false;
if (has_mt_) {
for (size_t i = 0; i < events_.size(); ++i) {
events_[i].x = info.GetAbsMtSlotValueWithDefault(ABS_MT_POSITION_X, i, 0);
@@ -188,7 +188,9 @@ void TouchEventConverterEvdev::Initialize(const EventDeviceInfo& info) {
info.GetAbsMtSlotValueWithDefault(ABS_MT_TOUCH_MINOR, i, 0) / 2.0f;
events_[i].pressure = ScalePressure(
info.GetAbsMtSlotValueWithDefault(ABS_MT_PRESSURE, i, 0));
- events_[i].cancelled = (major_max_ > 0 && touch_major == major_max_);
+ events_[i].cancelled = major_max_ > 0 && touch_major == major_max_;
+ if (events_[i].cancelled)
+ cancelled_state = true;
}
} else {
// TODO(spang): Add key state to EventDeviceInfo to allow initial contact.
@@ -204,6 +206,8 @@ void TouchEventConverterEvdev::Initialize(const EventDeviceInfo& info) {
events_[0].tool_code = 0;
events_[0].cancelled = false;
}
+ if (cancelled_state)
+ CancelAllTouches();
}
void TouchEventConverterEvdev::Reinitialize() {
@@ -445,6 +449,18 @@ void TouchEventConverterEvdev::ReportTouchEvent(
gfx::PointF(event.x, event.y), details, timestamp));
}
+void TouchEventConverterEvdev::CancelAllTouches() {
+ // TODO(denniskempin): Remove once upper layers properly handle single
+ // cancelled touches.
+ for (size_t i = 0; i < events_.size(); i++) {
+ InProgressTouchEvdev* event = &events_[i];
+ if (event->was_touching || event->touching) {
+ event->cancelled = true;
+ event->altered = true;
+ }
+ }
+}
+
void TouchEventConverterEvdev::ReportEvents(base::TimeTicks timestamp) {
if (dropped_events_) {
Reinitialize();
@@ -456,15 +472,22 @@ void TouchEventConverterEvdev::ReportEvents(base::TimeTicks timestamp) {
for (size_t i = 0; i < events_.size(); i++) {
InProgressTouchEvdev* event = &events_[i];
+ if (event->altered && (event->cancelled ||
+ (touch_noise_finder_ &&
+ touch_noise_finder_->SlotHasNoise(event->slot)))) {
+ CancelAllTouches();
+ break;
+ }
+ }
+
+ for (size_t i = 0; i < events_.size(); i++) {
+ InProgressTouchEvdev* event = &events_[i];
if (!event->altered)
continue;
if (enable_palm_suppression_callback_)
enable_palm_suppression_callback_.Run(event->tool_code > 0);
- if (touch_noise_finder_ && touch_noise_finder_->SlotHasNoise(event->slot))
- event->cancelled = true;
-
EventType event_type = GetEventTypeForTouch(*event);
// The tool type is fixed with the touch pressed event and does not change.
if (event_type == ET_TOUCH_PRESSED)
« no previous file with comments | « ui/events/ozone/evdev/touch_event_converter_evdev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698