Don't use FLTK's way to support HighDPI screens when the app has set a DPI awareness through a manifest.

FLTK reads during fl_open_display() the scaling factor of each screen and uses that to transform
FLTK units into screen units. This change avoids this reading if the app declared to be DPI-aware
though a manifest, a symptom that the app supports HighDPI independently from FLTK.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12677 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2018-02-18 16:58:38 +00:00
parent 6721ba67eb
commit 288d61a953

View File

@ -524,9 +524,10 @@ void Fl_WinAPI_Screen_Driver::open_display_platform() {
if (hMod) {
SetProcessDpiAwareness_type fl_SetProcessDpiAwareness = (SetProcessDpiAwareness_type)GetProcAddress(hMod, "SetProcessDpiAwareness");
const int PROCESS_PER_MONITOR_DPI_AWARE = 2;
if (fl_SetProcessDpiAwareness)
fl_SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
init_screen_scale_factors();
if (fl_SetProcessDpiAwareness) {
HRESULT hr = fl_SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
if (hr == S_OK) init_screen_scale_factors();
}
}
#endif // FLTK_HIDPI_SUPPORT
OleInitialize(0L);
@ -549,7 +550,7 @@ void Fl_WinAPI_Screen_Driver::init_screen_scale_factors() {
HRESULT r = fl_GetDpiForMonitor(hm, 0, &dpiX, &dpiY);
float f = (r == S_OK ? dpiX / 96. : 1);
scale(ns, f);
// fprintf(LOG, "desktop_scale_factor ns=%d factor=%.2f\n", ns, f);fflush(LOG);
//fprintf(LOG, "desktop_scale_factor ns=%d factor=%.2f\n", ns, scale(ns));fflush(LOG);
}
}
}