menu_view: update dialog when min w/h changes

The minimum width/height of a dialog is not specified in the dialog ROM
but in the menu_view configuration. So the regular dialog-ROM update
handling fails to captures dynamic changes of the minimum w/h. In
Sculpt, the panel would not always adjust immediately to a new screen
size.

This patch triggers a dialog update when detecting such configuration
changes (min w/h, opaqueness, background color).

Issue #5370
This commit is contained in:
Norman Feske 2024-10-28 12:40:24 +01:00 committed by Christian Helmuth
parent 9ad7111634
commit 732f310b26

View File

@ -228,10 +228,22 @@ struct Menu_view::Dialog : List_model<Dialog>::Element
void update(Xml_node const &node)
{
Point const orig_position = _position;
Area const orig_configured_size = _configured_size;
bool const orig_opaque = _opaque;
Color const orig_background_color = _background_color;
_position = Point::from_xml(node);
_configured_size = Area ::from_xml(node);
_opaque = node.attribute_value("opaque", false);
_background_color = node.attribute_value("background", Color(127, 127, 127, 255));
bool const any_change = (orig_position != _position
|| orig_configured_size != _configured_size
|| orig_opaque != _opaque
|| orig_background_color != _background_color);
if (any_change)
_dialog_handler.local_submit();
}
};