@@ -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;
@@ -114,13 +116,14 @@ static void fl_mock_view_send_mouse_pointer_event(
114116 size_t timestamp,
115117 double x,
116118 double y,
119+ FlutterPointerDeviceKind device_kind,
117120 double scroll_delta_x,
118121 double scroll_delta_y,
119122 int64_t buttons) {
120123 FlMockScrollingViewDelegatePrivate* priv =
121124 FL_MOCK_SCROLLING_VIEW_DELEGATE_GET_PRIVATE (delegate);
122- priv->mouse_handler (phase, timestamp, x, y, scroll_delta_x, scroll_delta_y ,
123- buttons);
125+ priv->mouse_handler (phase, timestamp, x, y, device_kind, scroll_delta_x ,
126+ scroll_delta_y, buttons);
124127}
125128
126129static void fl_mock_view_send_pointer_pan_zoom_event (
@@ -182,7 +185,8 @@ class ScrollingTester {
182185 fl_mock_scrolling_view_set_mouse_handler (
183186 view_,
184187 [](FlutterPointerPhase phase, size_t timestamp, double x, double y,
185- double scroll_delta_x, double scroll_delta_y, int64_t buttons) {
188+ FlutterPointerDeviceKind device_kind, double scroll_delta_x,
189+ double scroll_delta_y, int64_t buttons) {
186190 // do nothing
187191 });
188192 fl_mock_scrolling_view_set_pan_zoom_handler (
@@ -204,13 +208,15 @@ class ScrollingTester {
204208 std::vector<MousePointerEventRecord>& storage) {
205209 fl_mock_scrolling_view_set_mouse_handler (
206210 view_, [&storage](FlutterPointerPhase phase, size_t timestamp, double x,
207- double y, double scroll_delta_x,
208- double scroll_delta_y, int64_t buttons) {
211+ double y, FlutterPointerDeviceKind device_kind,
212+ double scroll_delta_x, double scroll_delta_y,
213+ int64_t buttons) {
209214 storage.push_back (MousePointerEventRecord{
210215 .phase = phase,
211216 .timestamp = timestamp,
212217 .x = x,
213218 .y = y,
219+ .device_kind = device_kind,
214220 .scroll_delta_x = scroll_delta_x,
215221 .scroll_delta_y = scroll_delta_y,
216222 .buttons = buttons,
@@ -278,6 +284,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
278284 EXPECT_EQ (mouse_records.size (), 1u );
279285 EXPECT_EQ (mouse_records[0 ].x , 4.0 );
280286 EXPECT_EQ (mouse_records[0 ].y , 8.0 );
287+ EXPECT_EQ (mouse_records[0 ].device_kind , kFlutterPointerDeviceKindMouse );
281288 EXPECT_EQ (mouse_records[0 ].timestamp ,
282289 1000lu); // Milliseconds -> Microseconds
283290 EXPECT_EQ (mouse_records[0 ].scroll_delta_x , 0 );
@@ -288,6 +295,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
288295 EXPECT_EQ (mouse_records.size (), 2u );
289296 EXPECT_EQ (mouse_records[1 ].x , 4.0 );
290297 EXPECT_EQ (mouse_records[1 ].y , 8.0 );
298+ EXPECT_EQ (mouse_records[1 ].device_kind , kFlutterPointerDeviceKindMouse );
291299 EXPECT_EQ (mouse_records[1 ].timestamp ,
292300 1000lu); // Milliseconds -> Microseconds
293301 EXPECT_EQ (mouse_records[1 ].scroll_delta_x , 0 );
@@ -298,6 +306,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
298306 EXPECT_EQ (mouse_records.size (), 3u );
299307 EXPECT_EQ (mouse_records[2 ].x , 4.0 );
300308 EXPECT_EQ (mouse_records[2 ].y , 8.0 );
309+ EXPECT_EQ (mouse_records[2 ].device_kind , kFlutterPointerDeviceKindMouse );
301310 EXPECT_EQ (mouse_records[2 ].timestamp ,
302311 1000lu); // Milliseconds -> Microseconds
303312 EXPECT_EQ (mouse_records[2 ].scroll_delta_x , 53 * -1.0 );
@@ -308,6 +317,7 @@ TEST(FlScrollingManagerTest, DiscreteDirectionional) {
308317 EXPECT_EQ (mouse_records.size (), 4u );
309318 EXPECT_EQ (mouse_records[3 ].x , 4.0 );
310319 EXPECT_EQ (mouse_records[3 ].y , 8.0 );
320+ EXPECT_EQ (mouse_records[3 ].device_kind , kFlutterPointerDeviceKindMouse );
311321 EXPECT_EQ (mouse_records[3 ].timestamp ,
312322 1000lu); // Milliseconds -> Microseconds
313323 EXPECT_EQ (mouse_records[3 ].scroll_delta_x , 53 * 1.0 );
@@ -335,6 +345,7 @@ TEST(FlScrollingManagerTest, DiscreteScrolling) {
335345 EXPECT_EQ (mouse_records.size (), 1u );
336346 EXPECT_EQ (mouse_records[0 ].x , 4.0 );
337347 EXPECT_EQ (mouse_records[0 ].y , 8.0 );
348+ EXPECT_EQ (mouse_records[0 ].device_kind , kFlutterPointerDeviceKindMouse );
338349 EXPECT_EQ (mouse_records[0 ].timestamp ,
339350 1000lu); // Milliseconds -> Microseconds
340351 EXPECT_EQ (mouse_records[0 ].scroll_delta_x , 53 * 1.0 );
0 commit comments