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 3aaaa315ba28df765aca924afa6efc9d139e583e..996e68ce5ef5530fcea47d84cbeb38da46e797fd 100644 |
--- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc |
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc |
@@ -29,6 +29,7 @@ |
#include "ui/events/event_constants.h" |
#include "ui/events/event_switches.h" |
#include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
+#include "ui/events/ozone/evdev/touch_noise/touch_noise_remover.h" |
namespace { |
@@ -83,6 +84,10 @@ TouchEventConverterEvdev::TouchEventConverterEvdev( |
is_type_a_(false), |
touch_points_(0), |
current_slot_(0) { |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kExtraTouchNoiseFiltering)) { |
+ touch_noise_remover_.reset(new TouchNoiseRemover); |
+ } |
} |
TouchEventConverterEvdev::~TouchEventConverterEvdev() { |
@@ -276,19 +281,16 @@ void TouchEventConverterEvdev::ProcessSyn(const input_event& input) { |
} |
} |
-void TouchEventConverterEvdev::ReportEvent(int touch_id, |
- const InProgressEvents& event, |
- const base::TimeDelta& timestamp) { |
- dispatcher_->DispatchTouchEvent(TouchEventParams( |
- id_, touch_id, event.type_, gfx::PointF(event.x_, event.y_), |
- gfx::Vector2dF(event.radius_x_, event.radius_y_), event.pressure_, |
- timestamp)); |
-} |
- |
void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { |
+ std::vector<TouchEventParams> to_dispatch; |
flackr
2015/03/10 05:23:40
If I understand correctly, we construct and copy c
pkotwicz
2015/03/13 03:53:16
I have refactored this as you requested
flackr
2015/03/13 15:08:35
Thanks!
|
for (size_t i = 0; i < events_.size(); i++) { |
if (events_[i].altered_) { |
- ReportEvent(i, events_[i], delta); |
+ const InProgressEvents& event = events_[i]; |
+ to_dispatch.push_back( |
+ TouchEventParams(id_, i, event.finger_, event.type_, |
+ gfx::PointF(event.x_, event.y_), |
+ gfx::Vector2dF(event.radius_x_, event.radius_y_), |
+ event.pressure_, delta)); |
// Subsequent events for this finger will be touch-move until it |
// is released. |
@@ -296,6 +298,12 @@ void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { |
events_[i].altered_ = false; |
} |
} |
+ |
+ if (touch_noise_remover_) |
+ touch_noise_remover_->RemoveNoise(&to_dispatch, delta); |
flackr
2015/03/10 05:23:39
Can't just remove updates for noisy touches and no
pkotwicz
2015/03/13 03:53:16
I have changed the code to dispatch ET_TOUCH_CANCE
flackr
2015/03/13 15:08:35
Thanks. That's very strange that we used to keep t
|
+ |
+ for (const TouchEventParams& params : to_dispatch) |
+ dispatcher_->DispatchTouchEvent(params); |
} |
} // namespace ui |