9
9
#include <xf86drmMode.h>
10
10
#include <stdint.h>
11
11
#include <flutter_embedder.h>
12
+ #include <stdlib.h>
13
+ #include <string.h>
12
14
13
15
#define EGL_PLATFORM_GBM_KHR 0x31D7
14
16
@@ -34,6 +36,8 @@ typedef enum {
34
36
kVBlankRequest ,
35
37
kVBlankReply ,
36
38
kUpdateOrientation ,
39
+ kSendPlatformMessage ,
40
+ kRespondToPlatformMessage ,
37
41
kFlutterTask
38
42
} flutterpi_task_type ;
39
43
@@ -47,11 +51,26 @@ struct flutterpi_task {
47
51
intptr_t baton ;
48
52
};
49
53
enum device_orientation orientation ;
54
+ struct {
55
+ char * channel ;
56
+ const FlutterPlatformMessageResponseHandle * responsehandle ;
57
+ size_t message_size ;
58
+ uint8_t * message ;
59
+ };
50
60
};
51
61
uint64_t target_time ;
52
62
};
53
63
54
- void post_platform_task (struct flutterpi_task * task );
64
+ static inline void * memdup (const void * restrict src , const size_t n ) {
65
+ void * __restrict__ dest ;
66
+
67
+ if ((src == NULL ) || (n == 0 )) return NULL ;
68
+
69
+ dest = malloc (n );
70
+ if (dest == NULL ) return NULL ;
71
+
72
+ return memcpy (dest , src , n );
73
+ }
55
74
56
75
struct drm_fb {
57
76
struct gbm_bo * bo ;
@@ -111,8 +130,6 @@ struct mousepointer_mtslot {
111
130
112
131
#define ISSET (uint32bitmap , bit ) (uint32bitmap[(bit)/32] & (1 << ((bit) & 0x1F)))
113
132
114
- #define STREQ (a , b ) (strcmp(a, b) == 0)
115
-
116
133
struct input_device {
117
134
char path [PATH_MAX ];
118
135
char name [256 ];
@@ -147,4 +164,15 @@ extern struct mousepointer_mtslot mousepointer;
147
164
148
165
extern FlutterEngine engine ;
149
166
167
+ void post_platform_task (struct flutterpi_task * task );
168
+
169
+ int flutterpi_send_platform_message (const char * channel ,
170
+ const uint8_t * restrict message ,
171
+ size_t message_size ,
172
+ FlutterPlatformMessageResponseHandle * responsehandle );
173
+
174
+ int flutterpi_respond_to_platform_message (FlutterPlatformMessageResponseHandle * handle ,
175
+ const uint8_t * restrict message ,
176
+ size_t message_size );
177
+
150
178
#endif
0 commit comments