Fix 07add7a9: [Win32] use full monitor resolution for fullscreen (#10985)

On Windows in fullscreen you cannot reach the top with
the cursor for the halve of the height of your toolbar.

Additionally, on Win10 in fullscreen you can see the actual toolbar.
This commit is contained in:
Patric Stout 2023-06-11 12:00:02 +02:00 committed by GitHub
parent 2097719f26
commit 6869f387ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -212,13 +212,18 @@ bool VideoDriver_Win32Base::MakeWindow(bool full_screen, bool resize)
if (this->main_wnd != nullptr) {
if (!_window_maximize && resize) SetWindowPos(this->main_wnd, 0, 0, 0, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
} else {
/* Center on the workspace of the primary display. */
MONITORINFO mi;
mi.cbSize = sizeof(mi);
GetMonitorInfo(MonitorFromWindow(0, MONITOR_DEFAULTTOPRIMARY), &mi);
int x = 0;
int y = 0;
int x = (mi.rcWork.right - mi.rcWork.left - w) / 2;
int y = (mi.rcWork.bottom - mi.rcWork.top - h) / 2;
/* For windowed mode, center on the workspace of the primary display. */
if (!this->fullscreen) {
MONITORINFO mi;
mi.cbSize = sizeof(mi);
GetMonitorInfo(MonitorFromWindow(0, MONITOR_DEFAULTTOPRIMARY), &mi);
x = (mi.rcWork.right - mi.rcWork.left - w) / 2;
y = (mi.rcWork.bottom - mi.rcWork.top - h) / 2;
}
std::string caption = VideoDriver::GetCaption();
this->main_wnd = CreateWindow(L"OTTD", OTTD2FS(caption).c_str(), style, x, y, w, h, 0, 0, GetModuleHandle(nullptr), this);