Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ui/events/ozone/evdev/tablet_event_converter_evdev.h

Issue 721823002: ozone: Interpret absolute events for graphics tablets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@o
Patch Set: Add missing initialisers for class members on TabletEventConverterEvdev Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ 5 #ifndef UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_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/message_loop/message_pump_libevent.h" 9 #include "base/message_loop/message_pump_libevent.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
11 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" 11 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
12 #include "ui/events/ozone/evdev/event_converter_evdev.h" 12 #include "ui/events/ozone/evdev/event_converter_evdev.h"
13 #include "ui/events/ozone/evdev/event_device_info.h"
13 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" 14 #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/events_ozone_evdev_export.h"
15 #include "ui/events/ozone/evdev/keyboard_evdev.h"
16 16
17 struct input_event; 17 struct input_event;
18 18
19 namespace ui { 19 namespace ui {
20 20
21 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl 21 class EVENTS_OZONE_EVDEV_EXPORT TabletEventConverterEvdev
22 : public EventConverterEvdev { 22 : public EventConverterEvdev {
23 public: 23 public:
24 EventConverterEvdevImpl(int fd, 24 TabletEventConverterEvdev(int fd,
25 base::FilePath path, 25 base::FilePath path,
26 int id, 26 int id,
27 EventModifiersEvdev* modifiers, 27 EventModifiersEvdev* modifiers,
28 CursorDelegateEvdev* cursor, 28 CursorDelegateEvdev* cursor,
29 KeyboardEvdev* keyboard, 29 const EventDeviceInfo& info,
30 const EventDispatchCallback& callback); 30 const EventDispatchCallback& callback);
31 ~EventConverterEvdevImpl() override; 31 virtual ~TabletEventConverterEvdev();
32 32
33 // EventConverterEvdev: 33 // EventConverterEvdev:
34 void OnFileCanReadWithoutBlocking(int fd) override; 34 void OnFileCanReadWithoutBlocking(int fd) override;
35 35
36 void ProcessEvents(const struct input_event* inputs, int count); 36 void ProcessEvents(const struct input_event* inputs, int count);
37 37
38 private: 38 private:
39 friend class MockTabletEventConverterEvdev;
39 void ConvertKeyEvent(const input_event& input); 40 void ConvertKeyEvent(const input_event& input);
40 41 void ConvertAbsEvent(const input_event& input);
41 void ConvertMouseMoveEvent(const input_event& input);
42
43 void DispatchMouseButton(const input_event& input); 42 void DispatchMouseButton(const input_event& input);
43 void UpdateCursor();
44 44
45 // Flush events delimited by EV_SYN. This is useful for handling 45 // Flush events delimited by EV_SYN. This is useful for handling
46 // non-axis-aligned movement properly. 46 // non-axis-aligned movement properly.
47 void FlushEvents(); 47 void FlushEvents();
48 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. 49 // Controller for watching the input fd.
56 base::MessagePumpLibevent::FileDescriptorWatcher controller_; 50 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
57 51
58 // Shared cursor state. 52 // Shared cursor state.
59 CursorDelegateEvdev* cursor_; 53 CursorDelegateEvdev* cursor_;
60 54
61 // Shared keyboard state.
62 KeyboardEvdev* keyboard_;
63
64 // Modifier key state (shift, ctrl, etc). 55 // Modifier key state (shift, ctrl, etc).
65 EventModifiersEvdev* modifiers_; 56 EventModifiersEvdev* modifiers_;
66 57
67 // Callback for dispatching events. 58 // Callback for dispatching events.
68 EventDispatchCallback callback_; 59 EventDispatchCallback callback_;
69 60
70 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl); 61 int y_abs_location_;
62 int x_abs_location_;
63 int x_abs_min_;
64 int y_abs_min_;
65 int x_abs_range_;
66 int y_abs_range_;
67
68 // BTN_TOOL_ code for the active device
69 int stylus_;
70
71 // Whether we need to move the cursor
72 bool abs_value_dirty_;
73
74 DISALLOW_COPY_AND_ASSIGN(TabletEventConverterEvdev);
71 }; 75 };
72 76
73 } // namespace ui 77 } // namespace ui
74 78
75 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_ 79 #endif // UI_EVENTS_OZONE_TABLET_EVENT_CONVERTER_EVDEV_H_
76
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_factory_evdev.cc ('k') | ui/events/ozone/evdev/tablet_event_converter_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698