feat: add Flutter USB mirroring and single-instance desktop clients

This commit is contained in:
tongtong committed 2026-11-12 23:16:56 +08:00
1 parent 3a7bb071f0
commit a339465392
30 files changed
+1688 -104

No files matched your search

@@ -1,4 +1,5 @@
#include "flutter_window.h"
#include "desktop_instance.h"
#include <optional>
@@ -26,6 +27,7 @@ bool FlutterWindow::OnCreate() {
}
RegisterPlugins(flutter_controller_->engine());
SetChildContent(flutter_controller_->view()->GetNativeWindow());
scrcpy_host_ = std::make_unique<ScrcpyHost>(flutter_controller_->engine()->messenger(), flutter_controller_->view()->GetNativeWindow());
flutter_controller_->engine()->SetNextFrameCallback([&]() {
this->Show();
@@ -40,6 +42,7 @@ bool FlutterWindow::OnCreate() {
}
void FlutterWindow::OnDestroy() {
scrcpy_host_.reset();
if (flutter_controller_) {
flutter_controller_ = nullptr;
}
@@ -51,6 +54,11 @@ LRESULT
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept {
if (message == DesktopInstance::ActivationMessage()) {
ShowWindow(hwnd, IsIconic(hwnd) ? SW_RESTORE : SW_SHOW);
SetForegroundWindow(hwnd);
return 0;
}
// Give Flutter, including plugins, an opportunity to handle window messages.
if (flutter_controller_) {
std::optional<LRESULT> result =