-
Notifications
You must be signed in to change notification settings - Fork 79
[ZH] Make game start on the monitor that it is launched from #543
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?
[ZH] Make game start on the monitor that it is launched from #543
Conversation
Is this to solve a specific problem? What about those who would like the game to open on a different monitor or where it was last opened? |
Well, right now it always starts up on the primary monitor, and I figured people prefer to have it launch where they start it. |
Yes, that would be ideal. |
I just updated the comments a bit |
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 think this change will produce the following user feedback:
"My game no longer launches on the correct screen !!!"
"Correct" meaning the primary screen that it was originally launched on, regardless where their exe or shortcut was.
I wonder if there is a strategy to avoid users running into unexpected window spawn locations that they do not like. We can assume that most players will take no issue with the original behaviour, but eventually will like or dislike this new behaviour, and the negative feedback will naturally overwhelm the positive feedback, which we need to avoid somehow.
Also, Noob players will not intuitively understand how to solve this situation.
rect.right-rect.left, | ||
rect.bottom-rect.top, | ||
(mi.rcMonitor.right+mi.rcMonitor.left-startWidth) / 2, | ||
(mi.rcMonitor.bottom+mi.rcMonitor.top-startHeight) / 2, |
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.
Can add some spacings around + to make easier on the eyes.
(GetSystemMetrics( SM_CXSCREEN ) / 2) - (startWidth / 2), // original position X | ||
(GetSystemMetrics( SM_CYSCREEN ) / 2) - (startHeight / 2),// original position Y | ||
//(GetSystemMetrics( SM_CXSCREEN ) / 2) - (startWidth / 2), // original position X | ||
//(GetSystemMetrics( SM_CYSCREEN ) / 2) - (startHeight / 2),// original position Y | ||
// Lorenzen nudged the window higher | ||
// so the constantdebug report would | ||
// not get obliterated by assert windows, thank you. | ||
//(GetSystemMetrics( SM_CXSCREEN ) / 2) - (startWidth / 2), //this works with any screen res | ||
//(GetSystemMetrics( SM_CYSCREEN ) / 25) - (startHeight / 25),//this works with any screen res |
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.
Can we remove all this commented code or do we need it for something?
I don't think most "noob" or accurately less tech savvy players would be likely to have a multi-monitor setup and have the game being launched from the second monitor. Regardless, having the program launch on the to display you launched it on is expected behavior and the default behavior of almost every other program Before working on the code I too found it to be quite an issue that I couldn't make the game launch on my secondary monitor. The easy fix for that should be win+shift+→ but that crashes without the alt tab fix and even with it still has issues such as not adjusting to the resolution of the second monitor and more. Changing the primary monitor isn't a feasible option because then task bar stuff isn't accessible |
It does not matter so much what other games do. There are plenty players who only play Generals, and nothing else. If we want to appeal to the established player base, then we need to give this thought. |
I understand both arguments. Personally, I just use one monitor anyway, so I don't really mind. But if I were using multiple monitors, I'd definitely find it annoying that the monitor cannot be selected. How about this: I add a commandline option which allows you to explicitely specify the monitor number to this PR, we merge this, and then we wait and see if anyone actually complains about the default and isn't happy to override the monitor via commandline.. |
Yes a command line option would probably be good enough for now. Should the new behaviour be the default or should the legacy behavior be the default? I currently only have one monitor, so I cannot test this change. How likely is it that users expect the game to launch where the shortcut is located, rather than launch on the Primary Monitor? I for one always expected the game to launch on the Primary Monitor, simply because it has done it since 20 years. |
Leave the original behaviour as the default. |
This PR fixes the window creation to open on the monitor the game is launched on.
This way, when the executable or a shortcut to it is opened on a certain monitor, the window opens on the same monitor. This also works when the game is started from the taskbar.
The code to do this may seem hacky, but it's exactly what the documentation for GetStartupInfo recommends.
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 WinMain.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