Repository navigation
bootloader: Windows: shorten the duration of spinning-wheel cursor - #8359
Merged
Merged
Conversation
bwoodsend
approved these changes
Mar 15, 2024
When using windowed/noconsole mode, attempt to shorten the duration of the spinning-wheel cursor that Windows uses to indicate that the process is starting. For programs using `/SUBSYSTEM:WINDOWS`, Windows displays the spinning wheel cursor for a fixed amount of time, or until the process makes use of UI functions (creates a window, uses message queue). In PyInstaller onefile applications, the parent process displays a window only if splash screen is used. Therefore, the spinning wheel cursor might be still shown well after the child process displays its UI. To prevent this, post and receive a message using message queue, which apparently suffices to convince Windows that the process is alive. Do this right before we spawn the child process, i.e., after the parent process finishes unpacking the program; this is to ensure that the spinning-wheel cursor is displayed for the whole duration of unpacking. In onedir applications, the spinning wheel should generally not be an issue (as there is only one process), except for background-style applications that do not display any UI. Such progams will appear to start faster if we have Windows hide the spinning-wheel cursor before we launch the python interpreter. So add calls using message queue in that codepath as well. We use the same combination of `PostMessage` and `GetMessage` that can also be found in python executable: https://github.com/python/cpython/blob/v3.12.2/PC/launcher.c#L765-L779
rokm
force-pushed
the
windows-spinning-cursor
branch
from
March 15, 2024 17:41
54b81c5 to
1a9d91e
Compare
Member
Author
|
Updated to use |
bwoodsend
approved these changes
Mar 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using windowed/noconsole mode, attempt to shorten the duration of the spinning-wheel cursor that Windows uses to indicate that the process is starting.
For programs using
/SUBSYSTEM:WINDOWS, Windows displays the spinning wheel cursor for a fixed amount of time, or until the process makes use of UI functions (creates a window, uses message queue).In PyInstaller onefile applications, the parent process displays a window only if splash screen is used. Therefore, the spinning wheel cursor might be still shown well after the child process displays its UI. To prevent this, use
PeekMessageto access the message queue, which apparently suffices to convince Windows that the process is alive. Do this right before we spawn the child process, i.e., after the parent process finishes unpacking the program; this is to ensure that the spinning-wheel cursor is displayed for the whole duration of unpacking.In onedir applications, the spinning wheel should generally not be an issue (as there is only one process), except for background-style applications that do not display any UI. Such progams will appear to start faster if we have Windows hide the spinning-wheel cursor before we launch the python interpreter. So add a call to
PeekMessagein that codepath as well.