Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / events / ozone / evdev / tablet_event_converter_evdev.h
blobf2bcde961aaa0c3b9f453734a35ffda9e5b2fe3c
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.
5 #ifndef UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_
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_device_info.h"
14 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
17 struct input_event;
19 namespace ui {
21 class DeviceEventDispatcherEvdev;
23 class EVENTS_OZONE_EVDEV_EXPORT TabletEventConverterEvdev
24 : public EventConverterEvdev {
25 public:
26 TabletEventConverterEvdev(int fd,
27 base::FilePath path,
28 int id,
29 CursorDelegateEvdev* cursor,
30 const EventDeviceInfo& info,
31 DeviceEventDispatcherEvdev* dispatcher);
32 ~TabletEventConverterEvdev() override;
34 // EventConverterEvdev:
35 void OnFileCanReadWithoutBlocking(int fd) override;
37 void ProcessEvents(const struct input_event* inputs, int count);
39 private:
40 friend class MockTabletEventConverterEvdev;
41 void ConvertKeyEvent(const input_event& input);
42 void ConvertAbsEvent(const input_event& input);
43 void DispatchMouseButton(const input_event& input);
44 void UpdateCursor();
46 // Flush events delimited by EV_SYN. This is useful for handling
47 // non-axis-aligned movement properly.
48 void FlushEvents(const input_event& input);
50 // Controller for watching the input fd.
51 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
53 // Shared cursor state.
54 CursorDelegateEvdev* cursor_;
56 // Dispatcher for events.
57 DeviceEventDispatcherEvdev* dispatcher_;
59 int y_abs_location_ = 0;
60 int x_abs_location_ = 0;
61 int x_abs_min_;
62 int y_abs_min_;
63 int x_abs_range_;
64 int y_abs_range_;
66 // BTN_TOOL_ code for the active device
67 int stylus_ = 0;
69 // Whether we need to move the cursor
70 bool abs_value_dirty_ = false;
72 // Set if we drop events in kernel (SYN_DROPPED) or in process.
73 bool dropped_events_ = false;
75 DISALLOW_COPY_AND_ASSIGN(TabletEventConverterEvdev);
78 } // namespace ui
80 #endif // UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_