Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66fef9f

Browse files
committed
Closes #17290: Loading cursor now does not persist when launching GUI scripts.
1 parent 2368704 commit 66fef9f

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

PC/launcher.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,21 @@ run_child(wchar_t * cmdline)
500500
STARTUPINFOW si;
501501
PROCESS_INFORMATION pi;
502502

503+
#if defined(_WINDOWS)
504+
// When explorer launches a Windows (GUI) application, it displays
505+
// the "app starting" (the "pointer + hourglass") cursor for a number
506+
// of seconds, or until the app does something UI-ish (eg, creating a
507+
// window, or fetching a message). As this launcher doesn't do this
508+
// directly, that cursor remains even after the child process does these
509+
// things. We avoid that by doing a simple post+get message.
510+
// See http://bugs.python.org/issue17290 and
511+
// https://bitbucket.org/vinay.sajip/pylauncher/issue/20/busy-cursor-for-a-long-time-when-running
512+
MSG msg;
513+
514+
PostMessage(0, 0, 0, 0);
515+
GetMessage(&msg, 0, 0, 0);
516+
#endif
517+
503518
debug(L"run_child: about to run '%s'\n", cmdline);
504519
job = CreateJobObject(NULL, NULL);
505520
ok = QueryInformationJobObject(job, JobObjectExtendedLimitInformation,
@@ -1362,4 +1377,4 @@ int cdecl wmain(int argc, wchar_t ** argv)
13621377
return process(argc, argv);
13631378
}
13641379

1365-
#endif
1380+
#endif

0 commit comments

Comments
 (0)