fix(windows): allow existing session to foreground (#16349)

Signed-off-by: TayfurYldz <238304586+TayfurYldz@users.noreply.github.com>
Co-authored-by: TayfurYldz <238304586+TayfurYldz@users.noreply.github.com>
This commit is contained in:
Tayfur Yıldız
2026-09-26 11:46:58 +08:00
committed by GitHub
co-authored by TayfurYldz
parent 08affc69c4
commit 17feabbcab
+8
View File
@@ -104,6 +104,14 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
}
if (!allow_multiple_instances) {
if (!command_line_arguments.empty()) {
// The process launched by the browser owns the foreground permission.
// Transfer it to the existing RustDesk process before dispatching the
// URI so that it can bring an existing session to the foreground.
DWORD pid = 0;
::GetWindowThreadProcessId(hwnd, &pid);
if (pid != 0) {
::AllowSetForegroundWindow(pid);
}
// Dispatch command line arguments
DispatchToUniLinksDesktop(hwnd);
} else {