OLD | NEW |
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 |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "base/threading/worker_pool.h" | 16 #include "base/threading/worker_pool.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
19 #include "ui/events/devices/device_data_manager.h" | 19 #include "ui/events/devices/device_data_manager.h" |
20 #include "ui/events/devices/device_util_linux.h" | 20 #include "ui/events/devices/device_util_linux.h" |
21 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 21 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
22 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" | 22 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" |
23 #include "ui/events/ozone/evdev/event_device_info.h" | 23 #include "ui/events/ozone/evdev/event_device_info.h" |
| 24 #include "ui/events/ozone/evdev/palm_suppression_filter.h" |
24 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.h" | 25 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.h" |
25 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" | 26 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" |
26 | 27 |
27 #if defined(USE_EVDEV_GESTURES) | 28 #if defined(USE_EVDEV_GESTURES) |
28 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 29 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
29 #include "ui/events/ozone/evdev/libgestures_glue/gesture_feedback.h" | 30 #include "ui/events/ozone/evdev/libgestures_glue/gesture_feedback.h" |
30 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" | 31 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" |
31 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" | 32 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" |
32 #endif | 33 #endif |
33 | 34 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 179 |
179 InputDeviceFactoryEvdev::InputDeviceFactoryEvdev( | 180 InputDeviceFactoryEvdev::InputDeviceFactoryEvdev( |
180 std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher, | 181 std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher, |
181 CursorDelegateEvdev* cursor) | 182 CursorDelegateEvdev* cursor) |
182 : task_runner_(base::ThreadTaskRunnerHandle::Get()), | 183 : task_runner_(base::ThreadTaskRunnerHandle::Get()), |
183 cursor_(cursor), | 184 cursor_(cursor), |
184 #if defined(USE_EVDEV_GESTURES) | 185 #if defined(USE_EVDEV_GESTURES) |
185 gesture_property_provider_(new GesturePropertyProvider), | 186 gesture_property_provider_(new GesturePropertyProvider), |
186 #endif | 187 #endif |
187 dispatcher_(std::move(dispatcher)), | 188 dispatcher_(std::move(dispatcher)), |
| 189 palm_filter_(new PalmSuppressionFilter(dispatcher_.get())), |
188 weak_ptr_factory_(this) { | 190 weak_ptr_factory_(this) { |
189 } | 191 } |
190 | 192 |
191 InputDeviceFactoryEvdev::~InputDeviceFactoryEvdev() { | 193 InputDeviceFactoryEvdev::~InputDeviceFactoryEvdev() { |
192 base::STLDeleteValues(&converters_); | 194 base::STLDeleteValues(&converters_); |
193 } | 195 } |
194 | 196 |
195 void InputDeviceFactoryEvdev::AddInputDevice(int id, | 197 void InputDeviceFactoryEvdev::AddInputDevice(int id, |
196 const base::FilePath& path) { | 198 const base::FilePath& path) { |
197 std::unique_ptr<OpenInputDeviceParams> params(new OpenInputDeviceParams); | 199 std::unique_ptr<OpenInputDeviceParams> params(new OpenInputDeviceParams); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 input_device_settings_.natural_scroll_enabled); | 337 input_device_settings_.natural_scroll_enabled); |
336 | 338 |
337 SetIntPropertyForOneType(DT_MOUSE, "Pointer Sensitivity", | 339 SetIntPropertyForOneType(DT_MOUSE, "Pointer Sensitivity", |
338 input_device_settings_.mouse_sensitivity); | 340 input_device_settings_.mouse_sensitivity); |
339 SetIntPropertyForOneType(DT_MOUSE, "Scroll Sensitivity", | 341 SetIntPropertyForOneType(DT_MOUSE, "Scroll Sensitivity", |
340 input_device_settings_.mouse_sensitivity); | 342 input_device_settings_.mouse_sensitivity); |
341 | 343 |
342 SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused", | 344 SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused", |
343 input_device_settings_.tap_to_click_paused); | 345 input_device_settings_.tap_to_click_paused); |
344 | 346 |
| 347 EventConverterEvdev* internal_pen = nullptr; |
| 348 EventConverterEvdev* internal_touch = nullptr; |
345 for (const auto& it : converters_) { | 349 for (const auto& it : converters_) { |
346 EventConverterEvdev* converter = it.second; | 350 EventConverterEvdev* converter = it.second; |
347 converter->SetEnabled(IsDeviceEnabled(converter)); | 351 converter->SetEnabled(IsDeviceEnabled(converter)); |
| 352 converter->SetPalmSuppressionFilter(nullptr); |
348 | 353 |
349 if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL && | 354 if (converter->type() == InputDeviceType::INPUT_DEVICE_INTERNAL) { |
350 converter->HasKeyboard()) { | 355 if (converter->HasKeyboard()) { |
351 converter->SetKeyFilter( | 356 converter->SetKeyFilter( |
352 input_device_settings_.enable_internal_keyboard_filter, | 357 input_device_settings_.enable_internal_keyboard_filter, |
353 input_device_settings_.internal_keyboard_allowed_keys); | 358 input_device_settings_.internal_keyboard_allowed_keys); |
| 359 } |
| 360 if (converter->HasPen()) { |
| 361 internal_pen = converter; |
| 362 } else if (converter->HasTouchscreen()) { |
| 363 internal_touch = converter; |
| 364 } |
354 } | 365 } |
355 | 366 |
356 converter->SetTouchEventLoggingEnabled( | 367 converter->SetTouchEventLoggingEnabled( |
357 input_device_settings_.touch_event_logging_enabled); | 368 input_device_settings_.touch_event_logging_enabled); |
358 } | 369 } |
| 370 |
| 371 if (internal_touch && internal_pen) { |
| 372 internal_touch->SetPalmSuppressionFilter(palm_filter_.get()); |
| 373 internal_pen->SetPalmSuppressionFilter(palm_filter_.get()); |
| 374 } |
359 } | 375 } |
360 | 376 |
361 void InputDeviceFactoryEvdev::ApplyCapsLockLed() { | 377 void InputDeviceFactoryEvdev::ApplyCapsLockLed() { |
362 for (const auto& it : converters_) { | 378 for (const auto& it : converters_) { |
363 EventConverterEvdev* converter = it.second; | 379 EventConverterEvdev* converter = it.second; |
364 converter->SetCapsLockLed(caps_lock_led_enabled_); | 380 converter->SetCapsLockLed(caps_lock_led_enabled_); |
365 } | 381 } |
366 } | 382 } |
367 | 383 |
368 bool InputDeviceFactoryEvdev::IsDeviceEnabled( | 384 bool InputDeviceFactoryEvdev::IsDeviceEnabled( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 std::vector<int> ids; | 501 std::vector<int> ids; |
486 gesture_property_provider_->GetDeviceIdsByType(type, &ids); | 502 gesture_property_provider_->GetDeviceIdsByType(type, &ids); |
487 for (size_t i = 0; i < ids.size(); ++i) { | 503 for (size_t i = 0; i < ids.size(); ++i) { |
488 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, | 504 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, |
489 value); | 505 value); |
490 } | 506 } |
491 #endif | 507 #endif |
492 } | 508 } |
493 | 509 |
494 } // namespace ui | 510 } // namespace ui |
OLD | NEW |