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

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

Issue 2653783002: ozone: Cancel all touches once a single touch is cancelled (Closed)
Patch Set: 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 dc88e3cac5b29440743950b5092aaf5ca0ac754d..7bc1282f88d66e920d9143319d7ede682522e502 100644
--- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
@@ -168,7 +168,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);
@@ -189,7 +189,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.
@@ -205,6 +207,8 @@ void TouchEventConverterEvdev::Initialize(const EventDeviceInfo& info) {
events_[0].tool_code = 0;
events_[0].cancelled = false;
}
+ if (cancelled_state)
+ CancelAllTouches();
}
void TouchEventConverterEvdev::Reinitialize() {
@@ -446,6 +450,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();
@@ -457,15 +473,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