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..900e961b2de566171a15b877d1395cd75720a837 100644 |
--- a/ui/events/ozone/evdev/input_device_factory_evdev.cc |
+++ b/ui/events/ozone/evdev/input_device_factory_evdev.cc |
@@ -239,6 +239,13 @@ void InputDeviceFactoryEvdev::AttachInputDevice( |
if (converters_[path]) |
DetachInputDevice(path); |
+ if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL && |
+ converter->HasPen()) { |
+ converter->SetPalmSuppressionCallback( |
+ base::Bind(&InputDeviceFactoryEvdev::EnablePalmSuppression, |
+ base::Unretained(this))); |
+ } |
+ |
// Add initialized device to map. |
converters_[path] = converter.release(); |
converters_[path]->Start(); |
@@ -376,6 +383,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 +503,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 |