| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/event_factory_evdev.h" | 5 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 | 9 |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
| 14 #include "ui/events/ozone/device/device_event.h" | 15 #include "ui/events/ozone/device/device_event.h" |
| 15 #include "ui/events/ozone/device/device_manager.h" | 16 #include "ui/events/ozone/device/device_manager.h" |
| 16 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 17 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 17 #include "ui/events/ozone/evdev/event_device_info.h" | 18 #include "ui/events/ozone/evdev/event_device_info.h" |
| 18 #include "ui/events/ozone/evdev/key_event_converter_evdev.h" | 19 #include "ui/events/ozone/evdev/key_event_converter_evdev.h" |
| 19 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" | 20 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" |
| 20 | 21 |
| 21 #if defined(USE_EVDEV_GESTURES) | 22 #if defined(USE_EVDEV_GESTURES) |
| 22 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 23 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 case DeviceEvent::REMOVE: { | 192 case DeviceEvent::REMOVE: { |
| 192 TRACE_EVENT1("ozone", "OnDeviceRemoved", "path", event.path().value()); | 193 TRACE_EVENT1("ozone", "OnDeviceRemoved", "path", event.path().value()); |
| 193 DetachInputDevice(event.path()); | 194 DetachInputDevice(event.path()); |
| 194 } | 195 } |
| 195 break; | 196 break; |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 void EventFactoryEvdev::OnDispatcherListChanged() { | 200 void EventFactoryEvdev::OnDispatcherListChanged() { |
| 200 if (!ui_task_runner_) { | 201 if (!ui_task_runner_) { |
| 201 ui_task_runner_ = base::MessageLoopProxy::current(); | 202 ui_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
| 202 // Scan & monitor devices. | 203 // Scan & monitor devices. |
| 203 device_manager_->AddObserver(this); | 204 device_manager_->AddObserver(this); |
| 204 device_manager_->ScanDevices(this); | 205 device_manager_->ScanDevices(this); |
| 205 } | 206 } |
| 206 } | 207 } |
| 207 | 208 |
| 208 void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) { | 209 void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) { |
| 209 TRACE_EVENT1("ozone", "DetachInputDevice", "path", path.value()); | 210 TRACE_EVENT1("ozone", "DetachInputDevice", "path", path.value()); |
| 210 CHECK(ui_task_runner_->RunsTasksOnCurrentThread()); | 211 CHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
| 211 | 212 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 233 MouseEvent mouse_event(ET_MOUSE_MOVED, | 234 MouseEvent mouse_event(ET_MOUSE_MOVED, |
| 234 cursor_->location(), | 235 cursor_->location(), |
| 235 cursor_->location(), | 236 cursor_->location(), |
| 236 modifiers_.GetModifierFlags(), | 237 modifiers_.GetModifierFlags(), |
| 237 /* changed_button_flags */ 0); | 238 /* changed_button_flags */ 0); |
| 238 DispatchEvent(&mouse_event); | 239 DispatchEvent(&mouse_event); |
| 239 } | 240 } |
| 240 } | 241 } |
| 241 | 242 |
| 242 } // namespace ui | 243 } // namespace ui |
| OLD | NEW |