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
This commit is contained in:
parent
288d61a953
commit
78183fb45b
@ -87,6 +87,10 @@ void fl_cleanup_dc_list(void);
|
|||||||
# include <wchar.h>
|
# include <wchar.h>
|
||||||
#endif
|
#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 bool fl_clipboard_notify_empty(void);
|
||||||
extern void fl_trigger_clipboard_notify(int source);
|
extern void fl_trigger_clipboard_notify(int source);
|
||||||
@ -519,14 +523,14 @@ void Fl_WinAPI_Screen_Driver::open_display_platform() {
|
|||||||
|
|
||||||
beenHereDoneThat = 1;
|
beenHereDoneThat = 1;
|
||||||
#ifdef FLTK_HIDPI_SUPPORT
|
#ifdef FLTK_HIDPI_SUPPORT
|
||||||
typedef HRESULT(WINAPI * SetProcessDpiAwareness_type)(int);
|
|
||||||
HMODULE hMod = LoadLibrary("Shcore.DLL");
|
HMODULE hMod = LoadLibrary("Shcore.DLL");
|
||||||
if (hMod) {
|
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;
|
const int PROCESS_PER_MONITOR_DPI_AWARE = 2;
|
||||||
if (fl_SetProcessDpiAwareness) {
|
if (fl_SetProcessDpiAwareness) {
|
||||||
HRESULT hr = fl_SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
|
HRESULT hr = fl_SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
|
||||||
if (hr == S_OK) init_screen_scale_factors();
|
if (hr == S_OK) init_screen_scale_factors();
|
||||||
|
else fl_SetProcessDpiAwareness = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // FLTK_HIDPI_SUPPORT
|
#endif // FLTK_HIDPI_SUPPORT
|
||||||
@ -1178,7 +1182,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||||||
|
|
||||||
#ifdef FLTK_HIDPI_SUPPORT
|
#ifdef FLTK_HIDPI_SUPPORT
|
||||||
case WM_DPICHANGED: { // 0x02E0
|
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;
|
RECT r;
|
||||||
float f = HIWORD(wParam) / 96.;
|
float f = HIWORD(wParam) / 96.;
|
||||||
GetClientRect(hWnd, &r);
|
GetClientRect(hWnd, &r);
|
||||||
|
Loading…
Reference in New Issue
Block a user