Slightly simpler Fl_WinAPI_Screen_Driver::init()

This commit is contained in:
ManoloFLTK 2019-06-18 13:35:39 +02:00
parent 643533b4b8
commit 23484c30a9
2 changed files with 3 additions and 5 deletions

View File

@ -452,11 +452,12 @@ int Fl_Screen_Driver::scale_handler(int event)
void Fl_Screen_Driver::use_startup_scale_factor()
{
char *p;
int s_count = screen_count();
desktop_scale_factor();
if ((p = fl_getenv("FLTK_SCALING_FACTOR"))) {
float factor = 1;
sscanf(p, "%f", &factor);
for (int i = 0; i < screen_count(); i++) scale(i, factor * scale(i));
for (int i = 0; i < s_count; i++) scale(i, factor * scale(i));
}
}

View File

@ -113,7 +113,6 @@ void Fl_WinAPI_Screen_Driver::init()
// we do a run-time check for the required functions...
HMODULE hMod = GetModuleHandle("USER32.DLL");
int old_num_screens = num_screens;
if (hMod) {
// check that EnumDisplayMonitors is available
fl_edm_func fl_edm = (fl_edm_func)GetProcAddress(hMod, "EnumDisplayMonitors");
@ -140,10 +139,8 @@ void Fl_WinAPI_Screen_Driver::init()
screens[0].right = GetSystemMetrics(SM_CXSCREEN);
screens[0].bottom = GetSystemMetrics(SM_CYSCREEN);
work_area[0] = screens[0];
scale_of_screen[0] = 1;
way_out:
// prevent desktop_scale_factor() from being called twice at app startup
if (old_num_screens >= 0) desktop_scale_factor();
desktop_scale_factor();
}