Chromium Code Reviews| Index: ui/events/ozone/evdev/input_device_factory_evdev.cc |
| diff --git a/ui/events/ozone/evdev/input_device_factory_evdev.cc b/ui/events/ozone/evdev/input_device_factory_evdev.cc |
| index 95f3867bc1d19a769da09e576096e9018d42d1e3..d639432dc1778dbe50d7c9e3c7bd67fd3396e23c 100644 |
| --- a/ui/events/ozone/evdev/input_device_factory_evdev.cc |
| +++ b/ui/events/ozone/evdev/input_device_factory_evdev.cc |
| @@ -239,6 +239,12 @@ void InputDeviceFactoryEvdev::AttachInputDevice( |
| if (converters_[path]) |
| DetachInputDevice(path); |
| + if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL && |
| + converter->HasPen()) |
|
spang
2016/08/26 22:20:03
Please add braces when the body spans more than on
denniskempin
2016/08/26 23:02:07
Done.
|
| + converter->SetPalmSuppressionCallback( |
| + base::Bind(&InputDeviceFactoryEvdev::EnablePalmSuppression, |
| + base::Unretained(this))); |
| + |
| // Add initialized device to map. |
| converters_[path] = converter.release(); |
| converters_[path]->Start(); |
| @@ -376,6 +382,11 @@ bool InputDeviceFactoryEvdev::IsDeviceEnabled( |
| converter->HasTouchscreen()) |
| return false; |
| + if (palm_suppression_enabled_ && |
| + converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL && |
| + converter->HasTouchscreen() && !converter->HasPen()) |
| + return false; |
| + |
| return input_device_settings_.enable_devices; |
| } |
| @@ -491,4 +502,14 @@ void InputDeviceFactoryEvdev::SetBoolPropertyForOneType( |
| #endif |
| } |
| +void InputDeviceFactoryEvdev::EnablePalmSuppression(bool enabled) { |
| + if (enabled == palm_suppression_enabled_) |
| + return; |
| + palm_suppression_enabled_ = enabled; |
| + |
| + for (const auto& it : converters_) { |
| + it.second->SetEnabled(IsDeviceEnabled(it.second)); |
| + } |
| +} |
| + |
| } // namespace ui |