diff options
author | falkTX <falktx@falktx.com> | 2021-07-02 09:01:21 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-10-09 11:09:02 -0400 |
commit | fbf5ed0b43dc28bf1118c42f417c7f498db9379d (patch) | |
tree | cfb7ab2349a580f56212e0fa997f887c87b43cd5 /src | |
parent | e1569942291787743e86ab7445944dc4d451ef73 (diff) | |
download | pugl-fbf5ed0b43dc28bf1118c42f417c7f498db9379d.tar.gz pugl-fbf5ed0b43dc28bf1118c42f417c7f498db9379d.tar.bz2 pugl-fbf5ed0b43dc28bf1118c42f417c7f498db9379d.zip |
Only call SetProcessDPIAware in programs
This prevents plugins from changing global host state, which causes serious
problems in hosts that are not DPI aware.
Diffstat (limited to 'src')
-rw-r--r-- | src/win.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -118,8 +118,7 @@ puglWinGetWindowExFlags(const PuglView* const view) } PuglWorldInternals* -puglInitWorldInternals(PuglWorldType PUGL_UNUSED(type), - PuglWorldFlags PUGL_UNUSED(flags)) +puglInitWorldInternals(PuglWorldType type, PuglWorldFlags PUGL_UNUSED(flags)) { PuglWorldInternals* impl = (PuglWorldInternals*)calloc(1, sizeof(PuglWorldInternals)); @@ -127,15 +126,17 @@ puglInitWorldInternals(PuglWorldType PUGL_UNUSED(type), return NULL; } - HMODULE user32 = LoadLibrary("user32.dll"); - if (user32) { - PFN_SetProcessDPIAware SetProcessDPIAware = - (PFN_SetProcessDPIAware)GetProcAddress(user32, "SetProcessDPIAware"); - if (SetProcessDPIAware) { - SetProcessDPIAware(); - } + if (type == PUGL_PROGRAM) { + HMODULE user32 = LoadLibrary("user32.dll"); + if (user32) { + PFN_SetProcessDPIAware SetProcessDPIAware = + (PFN_SetProcessDPIAware)GetProcAddress(user32, "SetProcessDPIAware"); + if (SetProcessDPIAware) { + SetProcessDPIAware(); + } - FreeLibrary(user32); + FreeLibrary(user32); + } } LARGE_INTEGER frequency; |