• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // Must match the button constants in events.dart.
13 enum PointerButtonMouse : int64_t {
14   kPointerButtonMousePrimary = 1 << 0,
15   kPointerButtonMouseSecondary = 1 << 1,
16   kPointerButtonMouseMiddle = 1 << 2,
17   kPointerButtonMouseBack = 1 << 3,
18   kPointerButtonMouseForward = 1 << 4,
19 };
20 
21 enum PointerButtonTouch : int64_t {
22   kPointerButtonTouchContact = 1 << 0,
23 };
24 
25 enum PointerButtonStylus : int64_t {
26   kPointerButtonStylusContact = 1 << 0,
27   kPointerButtonStylusPrimary = 1 << 1,
28   kPointerButtonStylusSecondary = 1 << 2,
29 };
30 
31 // This structure is unpacked by hooks.dart.
32 struct alignas(8) PointerData {
33   // Must match the PointerChange enum in pointer.dart.
34   enum class Change : int64_t {
35     kCancel,
36     kAdd,
37     kRemove,
38     kHover,
39     kDown,
40     kMove,
41     kUp,
42   };
43 
44   // Must match the PointerDeviceKind enum in pointer.dart.
45   enum class DeviceKind : int64_t {
46     kTouch,
47     kMouse,
48     kStylus,
49     kInvertedStylus,
50   };
51 
52   // Must match the PointerSignalKind enum in pointer.dart.
53   enum class SignalKind : int64_t {
54     kNone,
55     kScroll,
56   };
57 
58   int64_t time_stamp;
59   Change change;
60   DeviceKind kind;
61   SignalKind signal_kind;
62   int64_t device;
63   double physical_x;
64   double physical_y;
65   int64_t buttons;
66   int64_t obscured;
67   double pressure;
68   double pressure_min;
69   double pressure_max;
70   double distance;
71   double distance_max;
72   double size;
73   double radius_major;
74   double radius_minor;
75   double radius_min;
76   double radius_max;
77   double orientation;
78   double tilt;
79   int64_t platformData;
80   double scroll_delta_x;
81   double scroll_delta_y;
82 
83   void Clear();
84 };
85 
86 }  // namespace flutter
87 
88 #endif  // FLUTTER_LIB_UI_WINDOW_POINTER_DATA_H_
89