diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 1ac46ac7a..acfd62a50 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -339,8 +339,8 @@ packages: dependency: "direct main" description: path: "." - ref: "8b774a66671cbb9bcb2631af6ac28f9bdd469ce3" - resolved-ref: "8b774a66671cbb9bcb2631af6ac28f9bdd469ce3" + ref: "cddc2e64f8fefce4f80db87b20bcda2dd019bed6" + resolved-ref: "cddc2e64f8fefce4f80db87b20bcda2dd019bed6" url: "https://github.com/rustdesk-org/rustdesk_desktop_multi_window" source: git version: "0.1.0" diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index 7a2162c12..b99d08b88 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -58,7 +58,7 @@ dependencies: desktop_multi_window: git: url: https://github.com/rustdesk-org/rustdesk_desktop_multi_window - ref: 8b774a66671cbb9bcb2631af6ac28f9bdd469ce3 + ref: cddc2e64f8fefce4f80db87b20bcda2dd019bed6 freezed_annotation: ^2.0.3 flutter_custom_cursor: git: diff --git a/flutter/windows/runner/flutter_window.cpp b/flutter/windows/runner/flutter_window.cpp index 501436d71..e6617f363 100644 --- a/flutter/windows/runner/flutter_window.cpp +++ b/flutter/windows/runner/flutter_window.cpp @@ -59,19 +59,22 @@ constexpr UINT kForceRedrawMaxTries = 25; // per call (each nudge re-enters the 100ms resize wait). constexpr UINT kForceRedrawCheapTries = 2; -// Re-enters the embedder's OnWindowSizeChanged by nudging the Flutter child -// window by 1px and back: this resets the resize target and resends the window -// metrics. Same as BaseFlutterWindow::ForceChildRefresh() on the -// rustdesk_desktop_multi_window side. +// A nonzero intermediate width can time out before Flutter resizes its surface. +// Restoring the old width then leaves that intermediate resize pending. Zero +// width resends metrics without creating a new resize target, as in the plugin. void ForceChildRefresh(HWND child) { if (!child) { return; } + // FancyZones can queue a hide before the Flutter view is reparented. + if ((GetWindowLongPtr(child, GWL_STYLE) & WS_VISIBLE) == 0) { + ShowWindow(child, SW_SHOWNA); + } RECT rect; GetWindowRect(child, &rect); LONG width = rect.right - rect.left; LONG height = rect.bottom - rect.top; - SetWindowPos(child, nullptr, 0, 0, width + 1, height, + SetWindowPos(child, nullptr, 0, 0, 0, height, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED); SetWindowPos(child, nullptr, 0, 0, width, height, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);