From 288d61a953eb8f024a99f96a9f31dcc85cf554f4 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sun, 18 Feb 2018 16:58:38 +0000 Subject: 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 --- src/Fl_win32.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 20cf3e879..93ea280be 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -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); } } } -- cgit v1.2.3