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" | |
20 #include "ui/events/ozone/evdev/event_device_info.h" | 19 #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 EventConverterEvdevImpl. | 97 // Everything else: use KeyEventConverterEvdev. |
98 return make_scoped_ptr<EventConverterEvdevImpl>( | 98 return make_scoped_ptr<EventConverterEvdev>( |
99 new EventConverterEvdevImpl(fd, | 99 new KeyEventConverterEvdev(fd, params.path, params.id, params.keyboard)); |
100 params.path, | |
101 params.id, | |
102 params.modifiers, | |
103 params.cursor, | |
104 params.keyboard, | |
105 params.dispatch_callback)); | |
106 } | 100 } |
107 | 101 |
108 // Open an input device. Opening may put the calling thread to sleep, and | 102 // Open an input device. Opening may put the calling thread to sleep, and |
109 // therefore should be run on a thread where latency is not critical. We | 103 // therefore should be run on a thread where latency is not critical. We |
110 // run it on a thread from the worker pool. | 104 // run it on a thread from the worker pool. |
111 // | 105 // |
112 // This takes a TaskRunner and runs the reply on that thread, so that we | 106 // This takes a TaskRunner and runs the reply on that thread, so that we |
113 // can hop threads if necessary (back to the UI thread). | 107 // can hop threads if necessary (back to the UI thread). |
114 void OpenInputDevice(scoped_ptr<OpenInputDeviceParams> params, | 108 void OpenInputDevice(scoped_ptr<OpenInputDeviceParams> params, |
115 scoped_refptr<base::TaskRunner> reply_runner, | 109 scoped_refptr<base::TaskRunner> reply_runner, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 304 } |
311 | 305 |
312 observer->OnTouchscreenDevicesUpdated(touchscreens); | 306 observer->OnTouchscreenDevicesUpdated(touchscreens); |
313 } | 307 } |
314 | 308 |
315 int EventFactoryEvdev::NextDeviceId() { | 309 int EventFactoryEvdev::NextDeviceId() { |
316 return ++last_device_id_; | 310 return ++last_device_id_; |
317 } | 311 } |
318 | 312 |
319 } // namespace ui | 313 } // namespace ui |
OLD | NEW |