fix: siwtching display, clear last old image (#8810)

* fix: siwtching display, clear last old image

1. Clear last old image.
2. Try refresh after switching display.
3. Add an interval check before refresh video service.

Signed-off-by: dignow <linlong1265@gmail.com>

* simple changes

Signed-off-by: dignow <linlong1265@gmail.com>

---------

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2024-07-24 17:35:06 +08:00
committed by GitHub
parent c04f460bbd
commit 39dbd89287
4 changed files with 40 additions and 3 deletions

View File

@@ -2935,6 +2935,16 @@ openMonitorInTheSameTab(int i, FFI ffi, PeerInfo pi,
final displays = i == kAllDisplayValue
? List.generate(pi.displays.length, (index) => index)
: [i];
// Try clear image model before switching from all displays
// 1. The remote side has multiple displays.
// 2. Do not use texture render.
// 3. Connect to Display 1.
// 4. Switch to multi-displays `kAllDisplayValue`
// 5. Switch to Display 2.
// Then the remote page will display last picture of Display 1 at the beginning.
if (pi.forceTextureRender && i != kAllDisplayValue) {
ffi.imageModel.clearImage();
}
bind.sessionSwitchDisplay(
isDesktop: isDesktop,
sessionId: ffi.sessionId,

View File

@@ -1173,6 +1173,8 @@ class ImageModel with ChangeNotifier {
addCallbackOnFirstImage(Function(String) cb) => callbacksOnFirstImage.add(cb);
clearImage() => _image = null;
onRgba(int display, Uint8List rgba) {
final pid = parent.target?.id;
final rect = parent.target?.ffiModel.pi.getDisplayRect(display);