From fe0539314a4171481f2a0258378f3375bf8fc877 Mon Sep 17 00:00:00 2001 From: Jesse205 <2055675594@qq.com> Date: Sat, 11 Apr 2026 05:11:51 +0800 Subject: [PATCH 1/2] Fix cursor remains busy after launching windowed app --- src/pymanager/_launch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymanager/_launch.cpp b/src/pymanager/_launch.cpp index e4de999..662aebe 100644 --- a/src/pymanager/_launch.cpp +++ b/src/pymanager/_launch.cpp @@ -77,7 +77,7 @@ launch( (cmd_line && *cmd_line) ? L" " : L"", (cmd_line && *cmd_line) ? cmd_line + 1 : L""); -#if defined(_WINDOWS) +#if PY_WINDOWED /* When explorer launches a Windows (GUI) application, it displays the "app starting" (the "pointer + hourglass") cursor for a number From b6abf0a734cc912a68a2310a1a9dffa896bee5b2 Mon Sep 17 00:00:00 2001 From: Jesse205 <2055675594@qq.com> Date: Sat, 11 Apr 2026 05:40:39 +0800 Subject: [PATCH 2/2] Keep cursor busy state persistent from pymanager launch through Python interpreter startup --- src/pymanager/_launch.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/pymanager/_launch.cpp b/src/pymanager/_launch.cpp index 662aebe..f33feea 100644 --- a/src/pymanager/_launch.cpp +++ b/src/pymanager/_launch.cpp @@ -77,22 +77,6 @@ launch( (cmd_line && *cmd_line) ? L" " : L"", (cmd_line && *cmd_line) ? cmd_line + 1 : L""); -#if PY_WINDOWED - /* - When explorer launches a Windows (GUI) application, it displays - the "app starting" (the "pointer + hourglass") cursor for a number - of seconds, or until the app does something UI-ish (eg, creating a - window, or fetching a message). As this launcher doesn't do this - directly, that cursor remains even after the child process does these - things. We avoid that by doing a simple post+get message. - See http://bugs.python.org/issue17290 - */ - MSG msg; - - PostMessage(0, 0, 0, 0); - GetMessage(&msg, 0, 0, 0); -#endif - job = CreateJobObject(NULL, NULL); if (!job || !QueryInformationJobObject(job, JobObjectExtendedLimitInformation, &info, sizeof(info), &info_len) @@ -129,6 +113,23 @@ launch( AssignProcessToJobObject(job, pi.hProcess); CloseHandle(pi.hThread); + +#if PY_WINDOWED + /* + When explorer launches a Windows (GUI) application, it displays + the "app starting" (the "pointer + hourglass") cursor for a number + of seconds, or until the app does something UI-ish (eg, creating a + window, or fetching a message). As this launcher doesn't do this + directly, that cursor remains even after the child process does these + things. We avoid that by doing a simple post+get message. + See http://bugs.python.org/issue17290 + */ + MSG msg; + + PostMessage(0, 0, 0, 0); + GetMessage(&msg, 0, 0, 0); +#endif + WaitForSingleObjectEx(pi.hProcess, INFINITE, FALSE); if (!GetExitCodeProcess(pi.hProcess, exit_code)) { lastError = GetLastError();