An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
fix nextRgba not called when switching to texture render (#8792)
21pages57d1b1ecc40e
diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dartindex a9962a58a..51578055d 100644--- a/flutter/lib/models/model.dart+++ b/flutter/lib/models/model.dart@@ -2547,32 +2547,30 @@ class FFI {}} else if (message is EventToUI_Rgba) {final display = message.field0;- if (imageModel.useTextureRender || ffiModel.pi.forceTextureRender) {- //debugPrint("EventToUI_Rgba display:$display");- textureModel.setTextureType(display: display, gpuTexture: false);+ // Fetch the image buffer from rust codes.+ final sz = platformFFI.getRgbaSize(sessionId, display);+ if (sz == 0) {+ platformFFI.nextRgba(sessionId, display);+ return;+ }+ final rgba = platformFFI.getRgba(sessionId, display, sz);+ if (rgba != null) {onEvent2UIRgba();+ imageModel.onRgba(display, rgba);} else {- // Fetch the image buffer from rust codes.- final sz = platformFFI.getRgbaSize(sessionId, display);- if (sz == 0) {- platformFFI.nextRgba(sessionId, display);- return;- }- final rgba = platformFFI.getRgba(sessionId, display, sz);- if (rgba != null) {- onEvent2UIRgba();- imageModel.onRgba(display, rgba);- } else {- platformFFI.nextRgba(sessionId, display);- }+ platformFFI.nextRgba(sessionId, display);}} else if (message is EventToUI_Texture) {final display = message.field0;- debugPrint("EventToUI_Texture display:$display");- if (hasGpuTextureRender) {- textureModel.setTextureType(display: display, gpuTexture: true);- onEvent2UIRgba();+ final gpuTexture = message.field1;+ debugPrint(+ "EventToUI_Texture display:$display, gpuTexture:$gpuTexture");+ if (gpuTexture && !hasGpuTextureRender) {+ debugPrint('the gpuTexture is not supported.');+ return;}+ textureModel.setTextureType(display: display, gpuTexture: gpuTexture);+ onEvent2UIRgba();}}();});diff --git a/src/flutter.rs b/src/flutter.rsindex d1e44008b..3da754506 100644--- a/src/flutter.rs+++ b/src/flutter.rs@@ -794,7 +794,7 @@ impl InvokeUiSession for FlutterHandler {for (_, session) in self.session_handlers.read().unwrap().iter() {if session.renderer.on_texture(display, texture) {if let Some(stream) = &session.event_stream {- stream.add(EventToUI::Texture(display));+ stream.add(EventToUI::Texture(display, true));}}}@@ -1087,7 +1087,7 @@ impl FlutterHandler {if use_texture_render || session.displays.len() > 1 {if session.renderer.on_rgba(display, rgba) {if let Some(stream) = &session.event_stream {- stream.add(EventToUI::Rgba(display));+ stream.add(EventToUI::Texture(display, false));}}}diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rsindex 700c08704..870a65912 100644--- a/src/flutter_ffi.rs+++ b/src/flutter_ffi.rs@@ -89,7 +89,7 @@ pub fn stop_global_event_stream(app_type: String) {pub enum EventToUI {Event(String),Rgba(usize),- Texture(usize),+ Texture(usize, bool), // (display, gpu_texture)}pub fn host_stop_system_key_propagate(_stopped: bool) {