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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" 5 #include "ui/events/ozone/evdev/input_device_factory_evdev.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 input_device_settings_.natural_scroll_enabled); 335 input_device_settings_.natural_scroll_enabled);
336 336
337 SetIntPropertyForOneType(DT_MOUSE, "Pointer Sensitivity", 337 SetIntPropertyForOneType(DT_MOUSE, "Pointer Sensitivity",
338 input_device_settings_.mouse_sensitivity); 338 input_device_settings_.mouse_sensitivity);
339 SetIntPropertyForOneType(DT_MOUSE, "Scroll Sensitivity", 339 SetIntPropertyForOneType(DT_MOUSE, "Scroll Sensitivity",
340 input_device_settings_.mouse_sensitivity); 340 input_device_settings_.mouse_sensitivity);
341 341
342 SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused", 342 SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused",
343 input_device_settings_.tap_to_click_paused); 343 input_device_settings_.tap_to_click_paused);
344 344
345 EventConverterEvdev* internal_pen = nullptr;
345 for (const auto& it : converters_) { 346 for (const auto& it : converters_) {
346 EventConverterEvdev* converter = it.second; 347 EventConverterEvdev* converter = it.second;
347 converter->SetEnabled(IsDeviceEnabled(converter)); 348 bool enabled = IsDeviceEnabled(converter);
348 349
349 if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL && 350 if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL) {
350 converter->HasKeyboard()) { 351 if (converter->HasPen()) {
351 converter->SetKeyFilter( 352 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
352 input_device_settings_.enable_internal_keyboard_filter, 353 internal_pen = converter;
353 input_device_settings_.internal_keyboard_allowed_keys); 354 } else if (converter->HasTouchscreen()) {
355 enabled &= !palm_suppression_enabled_;
356 }
357
358 if (converter->HasKeyboard()) {
359 converter->SetKeyFilter(
360 input_device_settings_.enable_internal_keyboard_filter,
361 input_device_settings_.internal_keyboard_allowed_keys);
362 }
354 } 363 }
355 364 converter->SetEnabled(enabled);
356 converter->SetTouchEventLoggingEnabled( 365 converter->SetTouchEventLoggingEnabled(
357 input_device_settings_.touch_event_logging_enabled); 366 input_device_settings_.touch_event_logging_enabled);
358 } 367 }
368 if (internal_pen) {
369 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.
370 base::Bind(&InputDeviceFactoryEvdev::EnablePalmSuppression,
371 base::Unretained(this)));
372 }
359 } 373 }
360 374
361 void InputDeviceFactoryEvdev::ApplyCapsLockLed() { 375 void InputDeviceFactoryEvdev::ApplyCapsLockLed() {
362 for (const auto& it : converters_) { 376 for (const auto& it : converters_) {
363 EventConverterEvdev* converter = it.second; 377 EventConverterEvdev* converter = it.second;
364 converter->SetCapsLockLed(caps_lock_led_enabled_); 378 converter->SetCapsLockLed(caps_lock_led_enabled_);
365 } 379 }
366 } 380 }
367 381
368 bool InputDeviceFactoryEvdev::IsDeviceEnabled( 382 bool InputDeviceFactoryEvdev::IsDeviceEnabled(
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 #if defined(USE_EVDEV_GESTURES) 498 #if defined(USE_EVDEV_GESTURES)
485 std::vector<int> ids; 499 std::vector<int> ids;
486 gesture_property_provider_->GetDeviceIdsByType(type, &ids); 500 gesture_property_provider_->GetDeviceIdsByType(type, &ids);
487 for (size_t i = 0; i < ids.size(); ++i) { 501 for (size_t i = 0; i < ids.size(); ++i) {
488 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, 502 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name,
489 value); 503 value);
490 } 504 }
491 #endif 505 #endif
492 } 506 }
493 507
508 void InputDeviceFactoryEvdev::EnablePalmSuppression(bool enabled) {
509 if (enabled == palm_suppression_enabled_)
510 return;
511
512 for (const auto& it : converters_) {
513 EventConverterEvdev* converter = it.second;
514 if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL &&
515 converter->HasTouchscreen() && !converter->HasPen()) {
516 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.
517 }
518 }
519
520 palm_suppression_enabled_ = enabled;
521 }
522
494 } // namespace ui 523 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698