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/thread_task_runner_handle.h" |
14 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
15 #include "ui/events/device_data_manager.h" | 15 #include "ui/events/device_data_manager.h" |
16 #include "ui/events/ozone/device/device_event.h" | 16 #include "ui/events/ozone/device/device_event.h" |
17 #include "ui/events/ozone/device/device_manager.h" | 17 #include "ui/events/ozone/device/device_manager.h" |
18 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 18 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 19 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" |
19 #include "ui/events/ozone/evdev/event_device_info.h" | 20 #include "ui/events/ozone/evdev/event_device_info.h" |
20 #include "ui/events/ozone/evdev/key_event_converter_evdev.h" | |
21 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" | 21 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" |
22 | 22 |
23 #if defined(USE_EVDEV_GESTURES) | 23 #if defined(USE_EVDEV_GESTURES) |
24 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 24 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
25 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" | 25 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" |
26 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" | 26 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" |
27 #endif | 27 #endif |
28 | 28 |
29 #ifndef EVIOCSCLOCKID | 29 #ifndef EVIOCSCLOCKID |
30 #define EVIOCSCLOCKID _IOW('E', 0xa0, int) | 30 #define EVIOCSCLOCKID _IOW('E', 0xa0, int) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 fd, params.path, params.id, gesture_interp.Pass())); | 87 fd, params.path, params.id, gesture_interp.Pass())); |
88 } | 88 } |
89 #endif | 89 #endif |
90 | 90 |
91 // Touchscreen: use TouchEventConverterEvdev. | 91 // Touchscreen: use TouchEventConverterEvdev. |
92 scoped_ptr<EventConverterEvdev> converter; | 92 scoped_ptr<EventConverterEvdev> converter; |
93 if (devinfo.HasAbsXY()) | 93 if (devinfo.HasAbsXY()) |
94 return make_scoped_ptr<EventConverterEvdev>(new TouchEventConverterEvdev( | 94 return make_scoped_ptr<EventConverterEvdev>(new TouchEventConverterEvdev( |
95 fd, params.path, params.id, devinfo, params.dispatch_callback)); | 95 fd, params.path, params.id, devinfo, params.dispatch_callback)); |
96 | 96 |
97 // Everything else: use KeyEventConverterEvdev. | 97 // Everything else: use EventConverterEvdevImpl. |
98 return make_scoped_ptr<EventConverterEvdev>( | 98 return make_scoped_ptr<EventConverterEvdevImpl>( |
99 new KeyEventConverterEvdev(fd, params.path, params.id, params.keyboard)); | 99 new EventConverterEvdevImpl(fd, |
| 100 params.path, |
| 101 params.id, |
| 102 params.cursor, |
| 103 params.keyboard, |
| 104 params.dispatch_callback)); |
100 } | 105 } |
101 | 106 |
102 // Open an input device. Opening may put the calling thread to sleep, and | 107 // Open an input device. Opening may put the calling thread to sleep, and |
103 // therefore should be run on a thread where latency is not critical. We | 108 // therefore should be run on a thread where latency is not critical. We |
104 // run it on a thread from the worker pool. | 109 // run it on a thread from the worker pool. |
105 // | 110 // |
106 // This takes a TaskRunner and runs the reply on that thread, so that we | 111 // This takes a TaskRunner and runs the reply on that thread, so that we |
107 // can hop threads if necessary (back to the UI thread). | 112 // can hop threads if necessary (back to the UI thread). |
108 void OpenInputDevice(scoped_ptr<OpenInputDeviceParams> params, | 113 void OpenInputDevice(scoped_ptr<OpenInputDeviceParams> params, |
109 scoped_refptr<base::TaskRunner> reply_runner, | 114 scoped_refptr<base::TaskRunner> reply_runner, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 307 } |
303 | 308 |
304 observer->OnTouchscreenDevicesUpdated(touchscreens); | 309 observer->OnTouchscreenDevicesUpdated(touchscreens); |
305 } | 310 } |
306 | 311 |
307 int EventFactoryEvdev::NextDeviceId() { | 312 int EventFactoryEvdev::NextDeviceId() { |
308 return ++last_device_id_; | 313 return ++last_device_id_; |
309 } | 314 } |
310 | 315 |
311 } // namespace ui | 316 } // namespace ui |
OLD | NEW |