| 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 #ifndef UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_ |
| 6 #define UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_pump_libevent.h" | 10 #include "base/message_loop/message_pump_libevent.h" |
| 11 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
| 12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 13 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 13 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
| 14 #include "ui/events/ozone/evdev/event_device_info.h" | 14 #include "ui/events/ozone/evdev/event_device_info.h" |
| 15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
| 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 17 #include "ui/events/ozone/evdev/scoped_input_device.h" |
| 17 | 18 |
| 18 struct input_event; | 19 struct input_event; |
| 19 | 20 |
| 20 namespace ui { | 21 namespace ui { |
| 21 | 22 |
| 22 class DeviceEventDispatcherEvdev; | 23 class DeviceEventDispatcherEvdev; |
| 23 | 24 |
| 24 class EVENTS_OZONE_EVDEV_EXPORT TabletEventConverterEvdev | 25 class EVENTS_OZONE_EVDEV_EXPORT TabletEventConverterEvdev |
| 25 : public EventConverterEvdev { | 26 : public EventConverterEvdev { |
| 26 public: | 27 public: |
| 27 TabletEventConverterEvdev(int fd, | 28 TabletEventConverterEvdev(ScopedInputDevice fd, |
| 28 base::FilePath path, | 29 base::FilePath path, |
| 29 int id, | 30 int id, |
| 30 CursorDelegateEvdev* cursor, | 31 CursorDelegateEvdev* cursor, |
| 31 const EventDeviceInfo& info, | 32 const EventDeviceInfo& info, |
| 32 DeviceEventDispatcherEvdev* dispatcher); | 33 DeviceEventDispatcherEvdev* dispatcher); |
| 33 ~TabletEventConverterEvdev() override; | 34 ~TabletEventConverterEvdev() override; |
| 34 | 35 |
| 35 // EventConverterEvdev: | 36 // EventConverterEvdev: |
| 36 void OnFileCanReadWithoutBlocking(int fd) override; | 37 void OnFileCanReadWithoutBlocking(int fd) override; |
| 37 | 38 |
| 38 void ProcessEvents(const struct input_event* inputs, int count); | 39 void ProcessEvents(const struct input_event* inputs, int count); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 friend class MockTabletEventConverterEvdev; | 42 friend class MockTabletEventConverterEvdev; |
| 42 void ConvertKeyEvent(const input_event& input); | 43 void ConvertKeyEvent(const input_event& input); |
| 43 void ConvertAbsEvent(const input_event& input); | 44 void ConvertAbsEvent(const input_event& input); |
| 44 void DispatchMouseButton(const input_event& input); | 45 void DispatchMouseButton(const input_event& input); |
| 45 void UpdateCursor(); | 46 void UpdateCursor(); |
| 46 | 47 |
| 47 // Flush events delimited by EV_SYN. This is useful for handling | 48 // Flush events delimited by EV_SYN. This is useful for handling |
| 48 // non-axis-aligned movement properly. | 49 // non-axis-aligned movement properly. |
| 49 void FlushEvents(const input_event& input); | 50 void FlushEvents(const input_event& input); |
| 50 | 51 |
| 52 // Input device file descriptor. |
| 53 ScopedInputDevice input_device_fd_; |
| 54 |
| 51 // Controller for watching the input fd. | 55 // Controller for watching the input fd. |
| 52 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 56 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| 53 | 57 |
| 54 // Shared cursor state. | 58 // Shared cursor state. |
| 55 CursorDelegateEvdev* cursor_; | 59 CursorDelegateEvdev* cursor_; |
| 56 | 60 |
| 57 // Dispatcher for events. | 61 // Dispatcher for events. |
| 58 DeviceEventDispatcherEvdev* dispatcher_; | 62 DeviceEventDispatcherEvdev* dispatcher_; |
| 59 | 63 |
| 60 int y_abs_location_ = 0; | 64 int y_abs_location_ = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 82 | 86 |
| 83 // Set if we drop events in kernel (SYN_DROPPED) or in process. | 87 // Set if we drop events in kernel (SYN_DROPPED) or in process. |
| 84 bool dropped_events_ = false; | 88 bool dropped_events_ = false; |
| 85 | 89 |
| 86 DISALLOW_COPY_AND_ASSIGN(TabletEventConverterEvdev); | 90 DISALLOW_COPY_AND_ASSIGN(TabletEventConverterEvdev); |
| 87 }; | 91 }; |
| 88 | 92 |
| 89 } // namespace ui | 93 } // namespace ui |
| 90 | 94 |
| 91 #endif // UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_ | 95 #endif // UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_ |
| OLD | NEW |