-
Notifications
You must be signed in to change notification settings - Fork 65
[ZH] Center Window on Startup #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
base: main
Are you sure you want to change the base?
Conversation
…w title on slower computers and in debug build.
While this is neat, how do we want to handle cases where the user does not want this functionality. |
I'm gonna also ruin this and say, you will likely only center the initial window, the game makes two, one to show splash other for game, |
The current behavior is that the window starts in the bottom right corner. The bottom right part for the window is usually not visible. Tell me who wants this behavior?
Are you saying that this PR is wrong because you didn't get this feature to work in Thyme? If you look at the code or try out the build, you'll see that it works. |
No complaints over 15 years. Many users use the "Full" window preset in GenTool together with windowed mode. |
I can't use Full, it pulls the window to the left of my monitor 😢 : Also, I can think of a use case for other ultrawide users that may actually want the window on the left so that they can have another full-size window (Discord, OBS, etc.) on the right. |
I'm saying there may be unexpected behavior that may not always manifest due to the game making and destroying multiple windows during its startup |
The new official patch (1.05) adds window centering. I have no idea whether it's done in the same way as this PR, but certainly for me it's much appreciated after having to deal for so long with the game window starting out not only off-centered but also partially off-screen. Technically what appeared to happen originally is that the splash screen was centered but then the actual game window used the exact same top+left coordinates as the splash screen - so any game resolution besides 800x600 (which would be the same as the splash screen) necessarily resulted in it being off-centered. |
This does indeed look wrong, but sadly I cannot reproduce it. But I also don't have such a wide monitor or Windows 11. Did you disable DPI Scaling in the Compatibility Settings? Thanks! |
…Resize_And_Position_Window(). This results in the window centering when changing resolutions.
Never mind, I found the issue. I center the window in the workarea (area not occupied by taskbar and similar), but if the resolution is bigger than the workarea, it's better to center in the whole monitorarea. I just pushed a commit to fix this. @tintinhamans Can you check if the behavior is now fixed? |
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.
If the previous issues reported are confirmed fixed I'm happy to approve this?
Yes, please. |
This PR centers the window after loading on the screen (not including taskbar).
It also adds code to pump window messages during startup to avoid "(Not responding)" in the title. (That was necessary because Windows otherwise ignores the Move Call in debug builds, and maybe also on slower machines)
Also note that I needed to #define WINVER 0x0500, because the Monitor API didn't exist in Win 95 yet. This causes the compiler to emit a message when compiling dx8wrapper.cpp, but generates no error or warning. The game will also no longer run on Win95, but I think we can live with that.
Change list