fix window size preference on high dpi

This commit is contained in:
2019-05-12 10:58:10 +02:00
parent f0f78519ac
commit 5b26afa1a3

View File

@@ -647,7 +647,7 @@ int main(int argc, char** argv)
GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &x, &y);
App::I.zoom *= (float)x / 96.f;
RECT clientRect = { 0, 0, (int)App::I.width, (int)App::I.height };
RECT clientRect = { 0, 0, (int)App::I.width * App::I.zoom, (int)App::I.height * App::I.zoom };
POINT clientPos = { CW_USEDEFAULT, CW_USEDEFAULT };
if (Settings::has("window-rect"))
{
@@ -662,8 +662,8 @@ int main(int argc, char** argv)
AdjustWindowRect(&clientRect, WS_OVERLAPPEDWINDOW, false);
}
hWnd = CreateWindow(wc.lpszClassName, L"PanoPainter", WS_OVERLAPPEDWINDOW, clientPos.x, clientPos.y,
(float)(clientRect.right - clientRect.left) * App::I.zoom,
(float)(clientRect.bottom - clientRect.top) * App::I.zoom, 0, 0, hInst, 0);
(float)(clientRect.right - clientRect.left),
(float)(clientRect.bottom - clientRect.top), 0, 0, hInst, 0);
// Setup GL Rendering Context
pfd.nSize = sizeof(pfd);
@@ -724,8 +724,8 @@ int main(int argc, char** argv)
DestroyWindow(hWnd);
hWnd = CreateWindow(wc.lpszClassName, window_title, WS_OVERLAPPEDWINDOW, clientPos.x, clientPos.y,
(float)(clientRect.right - clientRect.left) * App::I.zoom,
(float)(clientRect.bottom - clientRect.top) * App::I.zoom, 0, 0, hInst, 0);
(float)(clientRect.right - clientRect.left),
(float)(clientRect.bottom - clientRect.top), 0, 0, hInst, 0);
hDC = GetDC(hWnd);
wglChoosePixelFormatARB(hDC, pixel_attribs, nullptr, 1, &pxfmt, &numFormat);