From 732f310b26a19402323fe3dbe399f8eb0cbf43c9 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 28 Oct 2024 12:40:24 +0100 Subject: [PATCH] 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 --- repos/gems/src/app/menu_view/dialog.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/repos/gems/src/app/menu_view/dialog.h b/repos/gems/src/app/menu_view/dialog.h index 3ac6fa9b8b..7571541a40 100644 --- a/repos/gems/src/app/menu_view/dialog.h +++ b/repos/gems/src/app/menu_view/dialog.h @@ -228,10 +228,22 @@ struct Menu_view::Dialog : List_model::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(); } };