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

source code of flutter_engine/flutter/lib/ui/window/pointer_data.h