diff --git a/src/main.cpp b/src/main.cpp index e6461e4..2c1cc81 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ #include "keymap.h" #include "../resource.h" +#include #include #include "wacom.h" #include @@ -289,6 +290,8 @@ int main(int argc, char** argv) WNDCLASS wc; PIXELFORMATDESCRIPTOR pfd; + SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); + if (argc == 1) App::I.initLog(); @@ -416,6 +419,16 @@ int main(int argc, char** argv) } } + auto monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST); + auto x = unsigned{}; + auto y = unsigned{}; + GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &x, &y); + App::I.zoom = (float)x / 96.f; +// SetWindowPos(hWnd, NULL, 0, 0, +// (clientRect.right - clientRect.left) * App::I.zoom, +// (clientRect.bottom - clientRect.top) * App::I.zoom, +// SWP_NOREPOSITION | SWP_NOOWNERZORDER); + App::I.init(); ShowWindow(hWnd, SW_NORMAL); diff --git a/src/pch.cpp b/src/pch.cpp index c32b633..df70a80 100644 --- a/src/pch.cpp +++ b/src/pch.cpp @@ -20,4 +20,5 @@ #pragma comment(lib, "glew32.lib") #pragma comment(lib, "wbemuuid.lib") #pragma comment(lib, "Shlwapi.lib") + #pragma comment(lib, "Shcore.lib") #endif // _WIN32