diff options
author | bubnikv <bubnikv@gmail.com> | 2019-05-06 19:28:23 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-05-06 19:28:23 +0300 |
commit | c9cd4818c7e8e15e48f1f88e6a29af9f1a2f5182 (patch) | |
tree | 37010521c4300c307a3db15c2e02f7bcdd078327 /src/slic3r/GUI/GUI_Utils.cpp | |
parent | 045879f68a07758aef43e4ae475d664f1c12f418 (diff) |
Improvements of High DPI scaling on Windows.
Diffstat (limited to 'src/slic3r/GUI/GUI_Utils.cpp')
-rw-r--r-- | src/slic3r/GUI/GUI_Utils.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp index 6dc5c5b4c..754e69351 100644 --- a/src/slic3r/GUI/GUI_Utils.cpp +++ b/src/slic3r/GUI/GUI_Utils.cpp @@ -64,6 +64,7 @@ template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const c } #endif +// If called with nullptr, a DPI for the primary monitor is returned. int get_dpi_for_window(wxWindow *window) { #ifdef _WIN32 @@ -82,7 +83,8 @@ int get_dpi_for_window(wxWindow *window) static auto GetDpiForWindow_fn = winapi_get_function<GetDpiForWindow_t>(L"User32.dll", "GetDpiForWindow"); static auto GetDpiForMonitor_fn = winapi_get_function<GetDpiForMonitor_t>(L"Shcore.dll", "GetDpiForMonitor"); - const HWND hwnd = window->GetHandle(); + // Desktop Window is the window of the primary monitor. + const HWND hwnd = (window == nullptr) ? ::GetDesktopWindow() : window->GetHandle(); if (GetDpiForWindow_fn != nullptr) { // We're on Windows 10, we have per-screen DPI settings |