1
0
Fork 0

PUI dialog correct positioning on HiDPI displays

Apply the device-pixel-ratio when calculating the initial position of
PUI dialogs, so they appear correctly (eg, centered) when running with
device-pixel-ratio != 1.0
This commit is contained in:
James Turner 2017-11-13 12:59:59 +01:00
parent b870b3f022
commit daedf1e546

View file

@ -783,8 +783,12 @@ FGPUIDialog::display (SGPropertyNode *props)
return; return;
} }
int screenw = globals->get_props()->getIntValue("/sim/startup/xsize"); // map from physical to logical units for PUI
int screenh = globals->get_props()->getIntValue("/sim/startup/ysize"); const double ratio = fgGetDouble("/sim/rendering/gui-pixel-ratio", 1.0);
const int physicalWidth = fgGetInt("/sim/startup/xsize"),
physicalHeight = fgGetInt("/sim/startup/ysize");
const int screenw = static_cast<int>(physicalWidth / ratio),
screenh = static_cast<int>(physicalHeight / ratio);
bool userx = props->hasValue("x"); bool userx = props->hasValue("x");
bool usery = props->hasValue("y"); bool usery = props->hasValue("y");