forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 78
[GEN][ZH] Center Game App Window on startup and resolution change #541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
befdc31
Center window in workarea on startup
helmutbuhler 6a9ae12
Remove extra code before SetWindowPos
helmutbuhler 4fc326e
Pump messages during startup to avoid "(Not responding)" in the windo…
helmutbuhler 966c029
Window centering: In case part of the resulting client area is off mo…
helmutbuhler 7373baa
Move common code to reposition window in helper function DX8Wrapper::…
helmutbuhler d72405a
Add comments for window positioning
helmutbuhler d8aaf71
Merge branch 'main' into center_window_ea
helmutbuhler 033be37
Put #define WINVER 0x0500 into #if for VC6
helmutbuhler 1fa513b
Expand some comments and fix whitespace
helmutbuhler 6ef01fa
Fix date format
helmutbuhler 659f87b
Merge branch 'main' into center_window_ea
xezon d798005
Update comments
xezon 6bcd039
Add logs for window position and size
xezon dbeb66c
Replicate in Generals
xezon f47c74e
Minor refactor
xezon 5585646
More minor word fixes
xezon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can this problem be reproduced? I tried this on my machine with Debug configuration and I cannot get the Window to be non responding during boot with and without this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, are you perhaps having a debugger attached? The buggy behavior will only occur if there is no debugger attached.
You can also try to insert a Sleep(5000); call instead of serviceWindowsOS(); When I do this, even the Release build shows buggy behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot confirm that this avoids "(Not Responding)" in the window title. I tested this with
But it does fix the window positioning as you say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, of course it shows the "(Not Responding)" if you put a Sleep in there :)
The original issue arises when you use Debug build without optimizations and without a debugger attached. In that case the startup is so slow that this "(Not Responding)" shenanigans arises without a Sleep call.
In case you are interested. MS has a little bit of documentation about this feature:
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-ishungappwindow?redirectedfrom=MSDN
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-disableprocesswindowsghosting
This undocumented function might also be of interest: HungWindowFromGhostWindow