From abbf56f2abff609987676a5980a1763d61dafd0d Mon Sep 17 00:00:00 2001 From: Kingtous Date: Mon, 10 Oct 2022 10:53:10 +0800 Subject: [PATCH] fix: use rawRGBa cursor workaround --- flutter/lib/desktop/pages/remote_page.dart | 4 +++- flutter/lib/models/model.dart | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 396e736e0..3757d96e6 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -404,7 +404,9 @@ class ImagePaint extends StatelessWidget { controller: _horizontal, thumbVisibility: false, trackVisibility: false, - notificationPredicate: (notification) => notification.depth == 1, + notificationPredicate: layoutSize.height < size.height + ? (notification) => notification.depth == 1 + : defaultScrollNotificationPredicate, child: widget, ), ); diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index c646f5285..6c800147e 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:io'; import 'dart:math'; import 'dart:typed_data'; import 'dart:ui' as ui; @@ -848,7 +849,12 @@ class CursorModel with ChangeNotifier { } _updateCacheLinux(ui.Image image, int id, int w, int h) async { - final data = await image.toByteData(format: ui.ImageByteFormat.png); + ByteData? data; + if (Platform.isWindows) { + data = await image.toByteData(format: ui.ImageByteFormat.rawRgba); + } else { + data = await image.toByteData(format: ui.ImageByteFormat.png); + } _cacheLinux = CursorData( peerId: this.id, data: data?.buffer.asUint8List(),