flutter_desktop: debug win cursor
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
9591c908a1
commit
2c34112492
@ -340,12 +340,14 @@ class ImagePaint extends StatelessWidget {
|
|||||||
return MouseCursor.defer;
|
return MouseCursor.defer;
|
||||||
} else {
|
} else {
|
||||||
final key = cacheLinux.updateGetKey(scale);
|
final key = cacheLinux.updateGetKey(scale);
|
||||||
cursor.addKeyLinux(key);
|
cursor.addKey(key);
|
||||||
return FlutterCustomMemoryImageCursor(
|
return FlutterCustomMemoryImageCursor(
|
||||||
pixbuf: cacheLinux.data,
|
pixbuf: cacheLinux.data,
|
||||||
key: key,
|
key: key,
|
||||||
hotx: cacheLinux.hotx,
|
// hotx: cacheLinux.hotx,
|
||||||
hoty: cacheLinux.hoty,
|
// hoty: cacheLinux.hoty,
|
||||||
|
hotx: 0,
|
||||||
|
hoty: 0,
|
||||||
imageWidth: (cacheLinux.width * cacheLinux.scale).toInt(),
|
imageWidth: (cacheLinux.width * cacheLinux.scale).toInt(),
|
||||||
imageHeight: (cacheLinux.height * cacheLinux.scale).toInt(),
|
imageHeight: (cacheLinux.height * cacheLinux.scale).toInt(),
|
||||||
);
|
);
|
||||||
@ -362,7 +364,7 @@ class ImagePaint extends StatelessWidget {
|
|||||||
cursor.updateForbiddenCursorBuffer();
|
cursor.updateForbiddenCursorBuffer();
|
||||||
}
|
}
|
||||||
final key = 'disabled_cursor_key';
|
final key = 'disabled_cursor_key';
|
||||||
cursor.addKeyLinux(key);
|
cursor.addKey(key);
|
||||||
return FlutterCustomMemoryImageCursor(
|
return FlutterCustomMemoryImageCursor(
|
||||||
pixbuf: cursor.cachedForbidmemoryCursorData,
|
pixbuf: cursor.cachedForbidmemoryCursorData,
|
||||||
key: key,
|
key: key,
|
||||||
|
@ -669,8 +669,8 @@ class CursorData {
|
|||||||
final img2.Image? image;
|
final img2.Image? image;
|
||||||
double scale;
|
double scale;
|
||||||
Uint8List? data;
|
Uint8List? data;
|
||||||
final double hotx;
|
double hotx;
|
||||||
final double hoty;
|
double hoty;
|
||||||
final int width;
|
final int width;
|
||||||
final int height;
|
final int height;
|
||||||
|
|
||||||
@ -705,7 +705,9 @@ class CursorData {
|
|||||||
width: (width * scale).toInt(),
|
width: (width * scale).toInt(),
|
||||||
height: (height * scale).toInt(),
|
height: (height * scale).toInt(),
|
||||||
)
|
)
|
||||||
.getBytes();
|
.getBytes(format: img2.Format.bgra);
|
||||||
|
hotx = (width * scale) / 2;
|
||||||
|
hoty = (height * scale) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
@ -721,9 +723,9 @@ class CursorData {
|
|||||||
class CursorModel with ChangeNotifier {
|
class CursorModel with ChangeNotifier {
|
||||||
ui.Image? _image;
|
ui.Image? _image;
|
||||||
final _images = <int, Tuple3<ui.Image, double, double>>{};
|
final _images = <int, Tuple3<ui.Image, double, double>>{};
|
||||||
CursorData? _cacheLinux;
|
CursorData? _cache;
|
||||||
final _cacheMapLinux = <int, CursorData>{};
|
final _cacheMap = <int, CursorData>{};
|
||||||
final _cacheKeysLinux = <String>{};
|
final _cacheKeys = <String>{};
|
||||||
double _x = -10000;
|
double _x = -10000;
|
||||||
double _y = -10000;
|
double _y = -10000;
|
||||||
double _hotx = 0;
|
double _hotx = 0;
|
||||||
@ -734,7 +736,7 @@ class CursorModel with ChangeNotifier {
|
|||||||
WeakReference<FFI> parent;
|
WeakReference<FFI> parent;
|
||||||
|
|
||||||
ui.Image? get image => _image;
|
ui.Image? get image => _image;
|
||||||
CursorData? get cacheLinux => _cacheLinux;
|
CursorData? get cacheLinux => _cache;
|
||||||
|
|
||||||
double get x => _x - _displayOriginX;
|
double get x => _x - _displayOriginX;
|
||||||
|
|
||||||
@ -748,8 +750,8 @@ class CursorModel with ChangeNotifier {
|
|||||||
|
|
||||||
CursorModel(this.parent);
|
CursorModel(this.parent);
|
||||||
|
|
||||||
Set<String> get cachedKeysLinux => _cacheKeysLinux;
|
Set<String> get cachedKeys => _cacheKeys;
|
||||||
addKeyLinux(String key) => _cacheKeysLinux.add(key);
|
addKey(String key) => _cacheKeys.add(key);
|
||||||
|
|
||||||
// remote physical display coordinate
|
// remote physical display coordinate
|
||||||
Rect getVisibleRect() {
|
Rect getVisibleRect() {
|
||||||
@ -919,7 +921,7 @@ class CursorModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_cacheLinux = CursorData(
|
_cache = CursorData(
|
||||||
peerId: this.id,
|
peerId: this.id,
|
||||||
id: id,
|
id: id,
|
||||||
image: image2,
|
image: image2,
|
||||||
@ -930,12 +932,12 @@ class CursorModel with ChangeNotifier {
|
|||||||
width: w,
|
width: w,
|
||||||
height: h,
|
height: h,
|
||||||
);
|
);
|
||||||
_cacheMapLinux[id] = _cacheLinux!;
|
_cacheMap[id] = _cache!;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCursorId(Map<String, dynamic> evt) async {
|
updateCursorId(Map<String, dynamic> evt) async {
|
||||||
final id = int.parse(evt['id']);
|
final id = int.parse(evt['id']);
|
||||||
_cacheLinux = _cacheMapLinux[id];
|
_cache = _cacheMap[id];
|
||||||
final tmp = _images[id];
|
final tmp = _images[id];
|
||||||
if (tmp != null) {
|
if (tmp != null) {
|
||||||
_image = tmp.item1;
|
_image = tmp.item1;
|
||||||
@ -983,15 +985,15 @@ class CursorModel with ChangeNotifier {
|
|||||||
_image = null;
|
_image = null;
|
||||||
_images.clear();
|
_images.clear();
|
||||||
|
|
||||||
_clearCacheLinux();
|
_clearCache();
|
||||||
_cacheLinux = null;
|
_cache = null;
|
||||||
_cacheMapLinux.clear();
|
_cacheMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
_clearCacheLinux() {
|
_clearCache() {
|
||||||
final cachedKeys = {...cachedKeysLinux};
|
final keys = {...cachedKeys};
|
||||||
for (var key in cachedKeys) {
|
for (var k in keys) {
|
||||||
customCursorController.freeCache(key);
|
customCursorController.freeCache(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1002,7 +1004,7 @@ class CursorModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
img2.Image? defaultCursorImage = img2.decodePng(base64Decode(
|
img2.Image? defaultCursorImage = img2.decodePng(base64Decode(
|
||||||
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAPCSURBVFiF7ZZBbBVVFIa/c+8w01daaKHYSkUQsQSbSIm4ELRqYlyoUQHbVcUmYmIg7EQSE5MmxI0LN4YuTBCDicYiDYSExiAxJrpoiDGURK2ChZYioNjS1/de583cOS5eiQJ99BU0uui/vDPn/N+Ze/PfgVnN6j+W3Grh9iMapMPRlI2MCZiX72whg4j+qwAvfa5zTTZcL4YnUX0ApAZJPEXSRvlFha9szLE9m1Jn/3GA9oO5RxF2ojwBlBd5TYGfFOm0Euz94HlJ3zZAR4eaM2smXkHZBdROumSShEGX8BtIZAxVVnSJCHdMljkVPpHQ7fiwteLCbQG0H8q9qsq7AhVAOBHJ0aFRc7B/WE7/Pu7lUJJUGXMaFrrapYvj5qpANxlhSQFUPtMk/9q+jfMu3xLAy4dyzaJ0AbWqMnopLbt7+vzDZAkRDPZv9XkSDPrQqvzKlfW6wzP6IICIvDMeBm/ubxU3lYcpZr61SytE2Unhs4eX0rK7p9fvJkeEh73GHMDH4GGP/+D3nzzjve0SfgRQ1S1z/Yl1xXyKAuT8cD3wOEAmL1/09PmHAW4wvl4e9sQpO/DrmLwP5IAFIrShOmVdUQAVngLKVckMj5pDZAmnNb8qwXzzc9AbOU4AKDS3dWfrSgbYfkQDVBsBnHKu/7ycRorD3iCL5EbIZvLyXWEa6o3IspIB0uFoCpFFAC6Ri5fHvUzJ01+VQ7ORDAOqkBJrFpUMYCNjILEFAGIcM45YCs4xoAIiLvFKBgiYl1cKKeYZqsvK8WcMYRHfUA0YhEhFrpQM0NlC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));
|
||||||
}
|
}
|
||||||
|
|
||||||
class QualityMonitorData {
|
class QualityMonitorData {
|
||||||
|
@ -77,7 +77,9 @@ class UserModel {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
final m = jsonDecode(userInfo);
|
final m = jsonDecode(userInfo);
|
||||||
|
if (m != null) {
|
||||||
userName.value = m['name'] ?? '';
|
userName.value = m['name'] ?? '';
|
||||||
|
}
|
||||||
return userName.value;
|
return userName.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user