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

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

Issue 2263693003: Add palm suppression feature to EventConverterEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stylus
Patch Set: simplified cancelation logic Created 4 years, 4 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/input_device_factory_evdev.h ('k') | ui/events/ozone/evdev/touch_evdev_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/events/ozone/evdev/input_device_factory_evdev.h ('k') | ui/events/ozone/evdev/touch_evdev_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698