| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/message_loop/message_pump_libevent.h" |
| 10 #include "ui/events/event.h" |
| 11 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 12 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
| 13 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
| 14 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 15 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
| 16 |
| 17 struct input_event; |
| 18 |
| 19 namespace ui { |
| 20 |
| 21 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl |
| 22 : public EventConverterEvdev { |
| 23 public: |
| 24 EventConverterEvdevImpl(int fd, |
| 25 base::FilePath path, |
| 26 int id, |
| 27 EventModifiersEvdev* modifiers, |
| 28 CursorDelegateEvdev* cursor, |
| 29 KeyboardEvdev* keyboard, |
| 30 const EventDispatchCallback& callback); |
| 31 virtual ~EventConverterEvdevImpl(); |
| 32 |
| 33 // EventConverterEvdev: |
| 34 void OnFileCanReadWithoutBlocking(int fd) override; |
| 35 |
| 36 private: |
| 37 void ProcessEvents(const struct input_event* inputs, int count); |
| 38 |
| 39 void ConvertKeyEvent(const input_event& input); |
| 40 |
| 41 void ConvertMouseMoveEvent(const input_event& input); |
| 42 |
| 43 void DispatchMouseButton(const input_event& input); |
| 44 |
| 45 // Flush events delimited by EV_SYN. This is useful for handling |
| 46 // non-axis-aligned movement properly. |
| 47 void FlushEvents(); |
| 48 |
| 49 // Save x-axis events of relative devices to be flushed at EV_SYN time. |
| 50 int x_offset_; |
| 51 |
| 52 // Save y-axis events of relative devices to be flushed at EV_SYN time. |
| 53 int y_offset_; |
| 54 |
| 55 // Controller for watching the input fd. |
| 56 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| 57 |
| 58 // Shared cursor state. |
| 59 CursorDelegateEvdev* cursor_; |
| 60 |
| 61 // Shared keyboard state. |
| 62 KeyboardEvdev* keyboard_; |
| 63 |
| 64 // Modifier key state (shift, ctrl, etc). |
| 65 EventModifiersEvdev* modifiers_; |
| 66 |
| 67 // Callback for dispatching events. |
| 68 EventDispatchCallback callback_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); |
| 71 }; |
| 72 |
| 73 } // namespace ui |
| 74 |
| 75 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ |
| 76 |
| OLD | NEW |