summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-02-19 10:18:55 +0000
committerManolo Gouy <Manolo>2018-02-19 10:18:55 +0000
commit78183fb45b61cf744fdc1950ec1f84cb921d1d0e (patch)
tree295b8f0c285c7e57617b1431e87305c7db161d7c
parent288d61a953eb8f024a99f96a9f31dcc85cf554f4 (diff)
Don't use FLTK's way to support HighDPI screens when the app has set a DPI awareness through a manifest - cont'd.
It's also necessary to prevent FLTK from rescaling windows moved between screens with different DPI's. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12678 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_win32.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 93ea280be..3a5447de7 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -87,6 +87,10 @@ void fl_cleanup_dc_list(void);
# include <wchar.h>
#endif
+#ifdef FLTK_HIDPI_SUPPORT
+ typedef HRESULT(WINAPI * SetProcessDpiAwareness_type)(int);
+ static SetProcessDpiAwareness_type fl_SetProcessDpiAwareness = NULL;
+#endif
extern bool fl_clipboard_notify_empty(void);
extern void fl_trigger_clipboard_notify(int source);
@@ -519,14 +523,14 @@ void Fl_WinAPI_Screen_Driver::open_display_platform() {
beenHereDoneThat = 1;
#ifdef FLTK_HIDPI_SUPPORT
- typedef HRESULT(WINAPI * SetProcessDpiAwareness_type)(int);
HMODULE hMod = LoadLibrary("Shcore.DLL");
if (hMod) {
- SetProcessDpiAwareness_type fl_SetProcessDpiAwareness = (SetProcessDpiAwareness_type)GetProcAddress(hMod, "SetProcessDpiAwareness");
+ fl_SetProcessDpiAwareness = (SetProcessDpiAwareness_type)GetProcAddress(hMod, "SetProcessDpiAwareness");
const int PROCESS_PER_MONITOR_DPI_AWARE = 2;
if (fl_SetProcessDpiAwareness) {
HRESULT hr = fl_SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
if (hr == S_OK) init_screen_scale_factors();
+ else fl_SetProcessDpiAwareness = NULL;
}
}
#endif // FLTK_HIDPI_SUPPORT
@@ -1178,7 +1182,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
#ifdef FLTK_HIDPI_SUPPORT
case WM_DPICHANGED: { // 0x02E0
- if (!Fl_WinAPI_Window_Driver::data_for_resize_window_between_screens_.busy) {
+ if (fl_SetProcessDpiAwareness && !Fl_WinAPI_Window_Driver::data_for_resize_window_between_screens_.busy) {
RECT r;
float f = HIWORD(wParam) / 96.;
GetClientRect(hWnd, &r);