1 | // Copyright 2013 The Flutter 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 FLUTTER_LIB_UI_WINDOW_POINTER_DATA_H_ |
6 | #define FLUTTER_LIB_UI_WINDOW_POINTER_DATA_H_ |
7 | |
8 | #include <stdint.h> |
9 | |
10 | namespace flutter { |
11 | |
12 | // If this value changes, update the pointer data unpacking code in hooks.dart. |
13 | static constexpr int kPointerDataFieldCount = 29; |
14 | static constexpr int kBytesPerField = sizeof(int64_t); |
15 | // Must match the button constants in events.dart. |
16 | enum PointerButtonMouse : int64_t { |
17 | kPointerButtonMousePrimary = 1 << 0, |
18 | kPointerButtonMouseSecondary = 1 << 1, |
19 | kPointerButtonMouseMiddle = 1 << 2, |
20 | kPointerButtonMouseBack = 1 << 3, |
21 | kPointerButtonMouseForward = 1 << 4, |
22 | }; |
23 | |
24 | enum PointerButtonTouch : int64_t { |
25 | kPointerButtonTouchContact = 1 << 0, |
26 | }; |
27 | |
28 | enum PointerButtonStylus : int64_t { |
29 | kPointerButtonStylusContact = 1 << 0, |
30 | kPointerButtonStylusPrimary = 1 << 1, |
31 | kPointerButtonStylusSecondary = 1 << 2, |
32 | }; |
33 | |
34 | // This structure is unpacked by hooks.dart. |
35 | struct alignas(8) PointerData { |
36 | // Must match the PointerChange enum in pointer.dart. |
37 | enum class Change : int64_t { |
38 | kCancel, |
39 | kAdd, |
40 | kRemove, |
41 | kHover, |
42 | kDown, |
43 | kMove, |
44 | kUp, |
45 | }; |
46 | |
47 | // Must match the PointerDeviceKind enum in pointer.dart. |
48 | enum class DeviceKind : int64_t { |
49 | kTouch, |
50 | kMouse, |
51 | kStylus, |
52 | kInvertedStylus, |
53 | }; |
54 | |
55 | // Must match the PointerSignalKind enum in pointer.dart. |
56 | enum class SignalKind : int64_t { |
57 | kNone, |
58 | kScroll, |
59 | }; |
60 | |
61 | int64_t embedder_id; |
62 | int64_t time_stamp; |
63 | Change change; |
64 | DeviceKind kind; |
65 | SignalKind signal_kind; |
66 | int64_t device; |
67 | int64_t pointer_identifier; |
68 | double physical_x; |
69 | double physical_y; |
70 | double physical_delta_x; |
71 | double physical_delta_y; |
72 | int64_t buttons; |
73 | int64_t obscured; |
74 | int64_t synthesized; |
75 | double pressure; |
76 | double pressure_min; |
77 | double pressure_max; |
78 | double distance; |
79 | double distance_max; |
80 | double size; |
81 | double radius_major; |
82 | double radius_minor; |
83 | double radius_min; |
84 | double radius_max; |
85 | double orientation; |
86 | double tilt; |
87 | int64_t platformData; |
88 | double scroll_delta_x; |
89 | double scroll_delta_y; |
90 | |
91 | void Clear(); |
92 | }; |
93 | |
94 | } // namespace flutter |
95 | |
96 | #endif // FLUTTER_LIB_UI_WINDOW_POINTER_DATA_H_ |
97 | |