GUI: Use a default size for dialogs when the overlayed dialog has not been sized

Some dialogs overlay the launcher's game list. However, the launcher is
not always shown and as such is not always layed out. Laying out the
dependent dialogs would fail. This problem was indroduced with the
dynamic layout system. Previously the dialogs were layed out eagerly on
theme initialization. Which is no longer possible as dialogs now need to
be initialized to be layed out.
This commit is contained in:
Bastien Bouclet 2020-01-29 18:44:16 +01:00
parent 9107f5cec2
commit f7a934b687

View File

@ -232,6 +232,14 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, (uint16 &) _w, (uint16 &) _h)) {
warning("Unable to retrieve overlayed dialog position %s", _overlays.c_str());
}
if (_w == -1 || _h == -1) {
warning("The overlayed dialog %s has not been sized, using a default size for %s", _overlays.c_str(), _name.c_str());
_x = g_system->getOverlayWidth() / 10;
_y = g_system->getOverlayHeight() / 10;
_w = g_system->getOverlayWidth() * 8 / 10;
_h = g_system->getOverlayHeight() * 8 / 10;
}
}
if (_x >= 0) _x += _inset;