flutter_desktop: fix resize scale && Pin peer menu bar

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-09-13 06:59:06 -07:00
parent ae570acd03
commit a075385a11
25 changed files with 146 additions and 116 deletions

View File

@@ -50,6 +50,8 @@ class _RemotePageState extends State<RemotePage>
var _isPhysicalMouse = false;
var _imageFocused = false;
final _onEnterOrLeaveImage = <Function(bool)>[];
late FFI _ffi;
void _updateTabBarHeight() {
@@ -421,11 +423,17 @@ class _RemotePageState extends State<RemotePage>
_physicalFocusNode.requestFocus();
}
_cursorOverImage.value = true;
for (var f in _onEnterOrLeaveImage) {
f(true);
}
_ffi.enterOrLeave(true);
}
void leaveView(PointerExitEvent evt) {
_cursorOverImage.value = false;
for (var f in _onEnterOrLeaveImage) {
f(false);
}
_ffi.enterOrLeave(false);
}
@@ -469,6 +477,7 @@ class _RemotePageState extends State<RemotePage>
paints.add(RemoteMenubar(
id: widget.id,
ffi: _ffi,
onEnterOrLeaveImage: _onEnterOrLeaveImage,
));
return Stack(
children: paints,
@@ -597,8 +606,8 @@ class ImagePaint extends StatelessWidget {
return FlutterCustomMemoryImageCursor(
pixbuf: cacheLinux.data,
key: key,
hotx: 0.0,
hoty: 0.0,
hotx: cacheLinux.hotx,
hoty: cacheLinux.hoty,
imageWidth: (cacheLinux.width * scale).toInt(),
imageHeight: (cacheLinux.height * scale).toInt(),
);