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:
parent
b870b3f022
commit
daedf1e546
1 changed files with 6 additions and 2 deletions
|
@ -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");
|
||||||
|
|
Loading…
Reference in a new issue