mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-29 19:20:28 +00:00
Correctly set "dpi awarness" in win32, making the app automatically
scale properly for high dpi displays.
This commit is contained in:
parent
2e2ee29cbb
commit
aad227681d
@ -75,6 +75,7 @@ App::App(const std::string& title) {
|
||||
|
||||
#ifdef WIN32
|
||||
this->iconId = 0;
|
||||
win32::ConfigureDpiAwareness();
|
||||
#else
|
||||
setlocale(LC_ALL, "");
|
||||
std::signal(SIGWINCH, resizedHandler);
|
||||
|
@ -252,6 +252,21 @@ namespace cursespp {
|
||||
resetMutex();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureDpiAwareness() {
|
||||
typedef HRESULT(__stdcall *SetProcessDpiAwarenessProc)(int);
|
||||
static const int ADJUST_DPI_PER_MONITOR = 2;
|
||||
|
||||
HMODULE dll = LoadLibrary(L"shcore.dll");
|
||||
if (dll) {
|
||||
SetProcessDpiAwarenessProc setDpiAwareness =
|
||||
(SetProcessDpiAwarenessProc) GetProcAddress(dll, "SetProcessDpiAwareness");
|
||||
|
||||
if (setDpiAwareness) {
|
||||
setDpiAwareness(ADJUST_DPI_PER_MONITOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ namespace cursespp {
|
||||
void EnableSingleInstance(const std::string& uniqueId);
|
||||
bool AlreadyRunning();
|
||||
void ShowOtherInstance();
|
||||
void ConfigureDpiAwareness();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user