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

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: Use enable/disable instead of palm suppression filter 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
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..c810de36dd488fb279592d11a3348451224460ad 100644
--- a/ui/events/ozone/evdev/input_device_factory_evdev.cc
+++ b/ui/events/ozone/evdev/input_device_factory_evdev.cc
@@ -342,20 +342,34 @@ void InputDeviceFactoryEvdev::ApplyInputDeviceSettings() {
SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused",
input_device_settings_.tap_to_click_paused);
+ EventConverterEvdev* internal_pen = nullptr;
for (const auto& it : converters_) {
EventConverterEvdev* converter = it.second;
- converter->SetEnabled(IsDeviceEnabled(converter));
-
- if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL &&
- converter->HasKeyboard()) {
- converter->SetKeyFilter(
- input_device_settings_.enable_internal_keyboard_filter,
- input_device_settings_.internal_keyboard_allowed_keys);
+ bool enabled = IsDeviceEnabled(converter);
+
+ if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL) {
+ if (converter->HasPen()) {
+ converter->SetPalmSuppressionCallback(base::Callback<void(bool)>());
spang 2016/08/26 00:58:34 This call isn't conditional on settings, can you d
denniskempin 2016/08/26 21:56:02 Done. I was a little paranoid about the theoretic
+ internal_pen = converter;
+ } else if (converter->HasTouchscreen()) {
+ enabled &= !palm_suppression_enabled_;
+ }
+
+ if (converter->HasKeyboard()) {
+ converter->SetKeyFilter(
+ input_device_settings_.enable_internal_keyboard_filter,
+ input_device_settings_.internal_keyboard_allowed_keys);
+ }
}
-
+ converter->SetEnabled(enabled);
converter->SetTouchEventLoggingEnabled(
input_device_settings_.touch_event_logging_enabled);
}
+ if (internal_pen) {
+ internal_pen->SetPalmSuppressionCallback(
spang 2016/08/26 00:58:34 Also this one. Unless it uses settings, it doesn't
denniskempin 2016/08/26 21:56:02 Done.
+ base::Bind(&InputDeviceFactoryEvdev::EnablePalmSuppression,
+ base::Unretained(this)));
+ }
}
void InputDeviceFactoryEvdev::ApplyCapsLockLed() {
@@ -491,4 +505,19 @@ void InputDeviceFactoryEvdev::SetBoolPropertyForOneType(
#endif
}
+void InputDeviceFactoryEvdev::EnablePalmSuppression(bool enabled) {
+ if (enabled == palm_suppression_enabled_)
+ return;
+
+ for (const auto& it : converters_) {
+ EventConverterEvdev* converter = it.second;
+ if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL &&
+ converter->HasTouchscreen() && !converter->HasPen()) {
+ converter->SetEnabled(!enabled);
spang 2016/08/26 00:58:34 The way to disable a device is to change the imple
denniskempin 2016/08/26 21:56:02 Done.
+ }
+ }
+
+ palm_suppression_enabled_ = enabled;
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698