@@ -47,7 +47,7 @@ struct user_input {
47
47
* used in the flutter pointer events
48
48
*/
49
49
FlutterTransformation display_to_view_transform ;
50
- FlutterTransformation display_to_view_transform_nontranslating ;
50
+ FlutterTransformation view_to_display_transform_nontranslating ;
51
51
unsigned int display_width ;
52
52
unsigned int display_height ;
53
53
@@ -96,6 +96,7 @@ struct user_input *user_input_new(
96
96
const struct user_input_interface * interface ,
97
97
void * userdata ,
98
98
const FlutterTransformation * display_to_view_transform ,
99
+ const FlutterTransformation * view_to_display_transform ,
99
100
unsigned int display_width ,
100
101
unsigned int display_height
101
102
) {
@@ -143,16 +144,19 @@ struct user_input *user_input_new(
143
144
#endif
144
145
145
146
input -> interface = * interface ;
147
+ input -> userdata = userdata ;
148
+
146
149
input -> libinput = libinput ;
147
150
input -> kbdcfg = kbdcfg ;
148
151
input -> next_unused_flutter_device_id = 0 ;
149
-
150
- input -> display_to_view_transform = * display_to_view_transform ;
151
- input -> display_to_view_transform_nontranslating = * display_to_view_transform ;
152
- input -> display_to_view_transform_nontranslating .transX = 0.0 ;
153
- input -> display_to_view_transform_nontranslating .transY = 0.0 ;
154
- input -> display_width = display_width ;
155
- input -> display_height = display_height ;
152
+
153
+ user_input_set_transform (
154
+ input ,
155
+ display_to_view_transform ,
156
+ view_to_display_transform ,
157
+ display_width ,
158
+ display_height
159
+ );
156
160
157
161
input -> n_cursor_devices = 0 ;
158
162
input -> cursor_flutter_device_id = -1 ;
@@ -184,14 +188,18 @@ void user_input_destroy(struct user_input *input) {
184
188
}
185
189
186
190
void user_input_set_transform (
187
- struct user_input * input ,
188
- const FlutterTransformation * display_to_view_transform ,
189
- unsigned int display_width ,
190
- unsigned int display_height
191
+ struct user_input * input ,
192
+ const FlutterTransformation * display_to_view_transform ,
193
+ const FlutterTransformation * view_to_display_transform ,
194
+ unsigned int display_width ,
195
+ unsigned int display_height
191
196
) {
192
- input -> display_to_view_transform = * display_to_view_transform ;
193
- input -> display_width = display_width ;
194
- input -> display_height = display_height ;
197
+ input -> display_to_view_transform = * display_to_view_transform ;
198
+ input -> view_to_display_transform_nontranslating = * view_to_display_transform ;
199
+ input -> view_to_display_transform_nontranslating .transX = 0.0 ;
200
+ input -> view_to_display_transform_nontranslating .transY = 0.0 ;
201
+ input -> display_width = display_width ;
202
+ input -> display_height = display_height ;
195
203
}
196
204
197
205
int user_input_get_fd (struct user_input * input ) {
@@ -235,6 +243,9 @@ static void emit_pointer_events(struct user_input *input, const FlutterPointerEv
235
243
236
244
// advance events so it points to the first remaining unemitted event
237
245
events += to_copy ;
246
+
247
+ // advance the number of stored pointer events
248
+ input -> n_collected_flutter_pointer_events += to_copy ;
238
249
}
239
250
}
240
251
@@ -329,6 +340,8 @@ static int on_device_added(struct user_input *input, struct libinput_event *even
329
340
libinput_device_set_user_data (device , NULL );
330
341
free (data );
331
342
}
343
+
344
+ return 0 ;
332
345
}
333
346
334
347
static int on_device_removed (struct user_input * input , struct libinput_event * event , uint64_t timestamp ) {
@@ -367,6 +380,8 @@ static int on_device_removed(struct user_input *input, struct libinput_event *ev
367
380
}
368
381
369
382
libinput_device_set_user_data (device , NULL );
383
+
384
+ return 0 ;
370
385
}
371
386
372
387
static int on_key_event (struct user_input * input , struct libinput_event * event ) {
@@ -426,10 +441,12 @@ static int on_key_event(struct user_input *input, struct libinput_event *event)
426
441
if (codepoint < 0x80 ) {
427
442
// we emit UTF8 unconditionally here,
428
443
// maybe we should check if codepoint is a control character?
429
- input -> interface .on_utf8_character (
430
- input -> userdata ,
431
- (uint8_t [1 ]) {codepoint }
432
- );
444
+ if (isprint (codepoint )) {
445
+ input -> interface .on_utf8_character (
446
+ input -> userdata ,
447
+ (uint8_t [1 ]) {codepoint }
448
+ );
449
+ }
433
450
} else if (codepoint < 0x800 ) {
434
451
input -> interface .on_utf8_character (
435
452
input -> userdata ,
@@ -494,7 +511,7 @@ static int on_mouse_motion_event(struct user_input *input, struct libinput_event
494
511
// we want the mouse to move in different directions as well.
495
512
// the dx and dy is still in display (not view) coordinates though,
496
513
// we only changed the movement direction.
497
- apply_flutter_transformation (input -> display_to_view_transform_nontranslating , & dx , & dy );
514
+ apply_flutter_transformation (input -> view_to_display_transform_nontranslating , & dx , & dy );
498
515
499
516
new_cursor_x = input -> cursor_x + dx ;
500
517
new_cursor_y = input -> cursor_y + dy ;
@@ -590,6 +607,8 @@ static int on_mouse_motion_absolute_event(struct user_input *input, struct libin
590
607
),
591
608
1
592
609
);
610
+
611
+ return 0 ;
593
612
}
594
613
595
614
static int on_mouse_button_event (struct user_input * input , struct libinput_event * event ) {
0 commit comments