@@ -13,6 +13,7 @@ typedef std::function<void(FlutterPointerPhase phase,
1313 size_t timestamp,
1414 double x,
1515 double y,
16+ FlutterPointerDeviceKind device_kind,
1617 double scroll_delta_x,
1718 double scroll_delta_y,
1819 int64_t buttons)>
@@ -32,6 +33,7 @@ typedef struct {
3233 size_t timestamp;
3334 double x;
3435 double y;
36+ FlutterPointerDeviceKind device_kind;
3537 double scroll_delta_x;
3638 double scroll_delta_y;
3739 int64_t buttons;
@@ -95,12 +97,13 @@ static void fl_mock_view_send_mouse_pointer_event(
9597 size_t timestamp,
9698 double x,
9799 double y,
100+ FlutterPointerDeviceKind device_kind,
98101 double scroll_delta_x,
99102 double scroll_delta_y,
100103 int64_t buttons) {
101104 FlMockScrollingViewDelegate* self = FL_MOCK_SCROLLING_VIEW_DELEGATE (delegate);
102- self->mouse_handler (phase, timestamp, x, y, scroll_delta_x, scroll_delta_y ,
103- buttons);
105+ self->mouse_handler (phase, timestamp, x, y, device_kind, scroll_delta_x ,
106+ scroll_delta_y, buttons);
104107}
105108
106109static void fl_mock_view_send_pointer_pan_zoom_event (
@@ -155,7 +158,8 @@ class ScrollingTester {
155158 fl_mock_scrolling_view_set_mouse_handler (
156159 view_,
157160 [](FlutterPointerPhase phase, size_t timestamp, double x, double y,
158- double scroll_delta_x, double scroll_delta_y, int64_t buttons) {
161+ FlutterPointerDeviceKind device_kind, double scroll_delta_x,
162+ double scroll_delta_y, int64_t buttons) {
159163 // do nothing
160164 });
161165 fl_mock_scrolling_view_set_pan_zoom_handler (
@@ -177,13 +181,15 @@ class ScrollingTester {
177181 std::vector<MousePointerEventRecord>& storage) {
178182 fl_mock_scrolling_view_set_mouse_handler (
179183 view_, [&storage](FlutterPointerPhase phase, size_t timestamp, double x,
180- double y, double scroll_delta_x,
181- double scroll_delta_y, int64_t buttons) {
184+ double y, FlutterPointerDeviceKind device_kind,
185+ double scroll_delta_x, double scroll_delta_y,
186+ int64_t buttons) {
182187 storage.push_back (MousePointerEventRecord{
183188 .phase = phase,
184189 .timestamp = timestamp,
185190 .x = x,
186191 .y = y,
192+ .device_kind = device_kind,
187193 .scroll_delta_x = scroll_delta_x,
188194 .scroll_delta_y = scroll_delta_y,
189195 .buttons = buttons,
@@ -249,6 +255,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
249255 EXPECT_EQ (mouse_records.size (), 1u );
250256 EXPECT_EQ (mouse_records[0 ].x , 4.0 );
251257 EXPECT_EQ (mouse_records[0 ].y , 8.0 );
258+ EXPECT_EQ (mouse_records[0 ].device_kind , kFlutterPointerDeviceKindMouse );
252259 EXPECT_EQ (mouse_records[0 ].timestamp ,
253260 1000lu); // Milliseconds -> Microseconds
254261 EXPECT_EQ (mouse_records[0 ].scroll_delta_x , 0 );
@@ -259,6 +266,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
259266 EXPECT_EQ (mouse_records.size (), 2u );
260267 EXPECT_EQ (mouse_records[1 ].x , 4.0 );
261268 EXPECT_EQ (mouse_records[1 ].y , 8.0 );
269+ EXPECT_EQ (mouse_records[1 ].device_kind , kFlutterPointerDeviceKindMouse );
262270 EXPECT_EQ (mouse_records[1 ].timestamp ,
263271 1000lu); // Milliseconds -> Microseconds
264272 EXPECT_EQ (mouse_records[1 ].scroll_delta_x , 0 );
@@ -269,6 +277,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
269277 EXPECT_EQ (mouse_records.size (), 3u );
270278 EXPECT_EQ (mouse_records[2 ].x , 4.0 );
271279 EXPECT_EQ (mouse_records[2 ].y , 8.0 );
280+ EXPECT_EQ (mouse_records[2 ].device_kind , kFlutterPointerDeviceKindMouse );
272281 EXPECT_EQ (mouse_records[2 ].timestamp ,
273282 1000lu); // Milliseconds -> Microseconds
274283 EXPECT_EQ (mouse_records[2 ].scroll_delta_x , 53 * -1.0 );
@@ -279,6 +288,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
279288 EXPECT_EQ (mouse_records.size (), 4u );
280289 EXPECT_EQ (mouse_records[3 ].x , 4.0 );
281290 EXPECT_EQ (mouse_records[3 ].y , 8.0 );
291+ EXPECT_EQ (mouse_records[3 ].device_kind , kFlutterPointerDeviceKindMouse );
282292 EXPECT_EQ (mouse_records[3 ].timestamp ,
283293 1000lu); // Milliseconds -> Microseconds
284294 EXPECT_EQ (mouse_records[3 ].scroll_delta_x , 53 * 1.0 );
@@ -305,6 +315,7 @@ TEST(FlScrollingManagerTest, DiscreteScrolling) {
305315 EXPECT_EQ (mouse_records.size (), 1u );
306316 EXPECT_EQ (mouse_records[0 ].x , 4.0 );
307317 EXPECT_EQ (mouse_records[0 ].y , 8.0 );
318+ EXPECT_EQ (mouse_records[0 ].device_kind , kFlutterPointerDeviceKindMouse );
308319 EXPECT_EQ (mouse_records[0 ].timestamp ,
309320 1000lu); // Milliseconds -> Microseconds
310321 EXPECT_EQ (mouse_records[0 ].scroll_delta_x , 53 * 1.0 );
0 commit comments