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

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

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 months 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
(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 <bitset>
9
10 #include "base/files/file_path.h"
11 #include "base/message_loop/message_pump_libevent.h"
12 #include "ui/events/devices/input_device.h"
13 #include "ui/events/event.h"
14 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
15 #include "ui/events/ozone/evdev/event_converter_evdev.h"
16 #include "ui/events/ozone/evdev/event_device_info.h"
17 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
18 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
19 #include "ui/events/ozone/evdev/keyboard_evdev.h"
20 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
21
22 struct input_event;
23
24 namespace ui {
25
26 class DeviceEventDispatcherEvdev;
27
28 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl
29 : public EventConverterEvdev {
30 public:
31 EventConverterEvdevImpl(int fd,
32 base::FilePath path,
33 int id,
34 InputDeviceType type,
35 const EventDeviceInfo& info,
36 CursorDelegateEvdev* cursor,
37 DeviceEventDispatcherEvdev* dispatcher);
38 ~EventConverterEvdevImpl() override;
39
40 // EventConverterEvdev:
41 void OnFileCanReadWithoutBlocking(int fd) override;
42 bool HasKeyboard() const override;
43 bool HasTouchpad() const override;
44 bool HasCapsLockLed() const override;
45 void SetKeyFilter(bool enable_filter,
46 std::vector<DomCode> allowed_keys) override;
47 void OnDisabled() override;
48
49 void ProcessEvents(const struct input_event* inputs, int count);
50
51 private:
52 void ConvertKeyEvent(const input_event& input);
53 void ConvertMouseMoveEvent(const input_event& input);
54 void OnKeyChange(unsigned int key,
55 bool down,
56 const base::TimeDelta& timestamp);
57 void ReleaseKeys();
58 void ReleaseMouseButtons();
59 void OnLostSync();
60 void DispatchMouseButton(const input_event& input);
61 void OnButtonChange(int code, bool down, const base::TimeDelta& timestamp);
62
63 // Flush events delimited by EV_SYN. This is useful for handling
64 // non-axis-aligned movement properly.
65 void FlushEvents(const input_event& input);
66
67 // Input modalities for this device.
68 bool has_keyboard_;
69 bool has_touchpad_;
70
71 // LEDs for this device.
72 bool has_caps_lock_led_;
73
74 // Save x-axis events of relative devices to be flushed at EV_SYN time.
75 int x_offset_ = 0;
76
77 // Save y-axis events of relative devices to be flushed at EV_SYN time.
78 int y_offset_ = 0;
79
80 // Controller for watching the input fd.
81 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
82
83 // The evdev codes of the keys which should be blocked.
84 std::bitset<KEY_CNT> blocked_keys_;
85
86 // Pressed keys bitset.
87 std::bitset<KEY_CNT> key_state_;
88
89 // Last mouse button state.
90 static const int kMouseButtonCount = BTN_JOYSTICK - BTN_MOUSE;
91 std::bitset<kMouseButtonCount> mouse_button_state_;
92
93 // Shared cursor state.
94 CursorDelegateEvdev* cursor_;
95
96 // Callbacks for dispatching events.
97 DeviceEventDispatcherEvdev* dispatcher_;
98
99 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl);
100 };
101
102 } // namespace ui
103
104 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_IMPL_H_
105
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_converter_evdev.cc ('k') | ui/events/ozone/evdev/event_converter_evdev_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698