From 6aa239c01fc9d2b33ccf0eb8f491659d4a1341f6 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 26 Sep 2014 14:57:00 +0100 Subject: [PATCH] Fixed first-run window fitting with DPI scaling. Closes #309. --- src/gui/handler.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index 0bde5e6f..b29b9375 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -1121,6 +1121,16 @@ namespace loot { SetWindowPos(hWnd, HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW); #endif } + else { +#ifdef _WIN32 + // High DPI support doesn't seem to scale window content correctly + // unless the window is resized, so if no size info is recorded, + // just set its current size + 1. + RECT rc; + GetWindowRect(browser->GetHost()->GetWindowHandle(), &rc); + SetWindowPos(browser->GetHost()->GetWindowHandle(), HWND_TOP, rc.left, rc.top, rc.right - rc.left + 1, rc.bottom - rc.top + 1, SWP_SHOWWINDOW); +#endif + } // Add to the list of existing browsers. browser_list_.push_back(browser);