vcl/unx/gtk3/gtkinst.cxx | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
New commits: commit 5c5b058c83e31e798a63a96d0e16b35927ce519f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue May 18 10:37:53 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue May 18 12:36:57 2021 +0200 gtk4: relocate GtkButton image to be a child of the GtkButton Change-Id: Iaf63de3eeebd575bc664d07b0254577219bf1bde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115730 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index b1b3f7dfc9f6..08d21e0728df 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -17803,6 +17803,50 @@ bool ConvertTree(const Reference<css::xml::dom::XNode>& xNode) xRemoveList.push_back(xChild); } + if (sName == "image") + { + if (GetParentObjectType(xChild) == "GtkButton") + { + // find the image object, expected to be a child of "interface" and relocate + // it to be a child of this GtkButton + auto xObjectCandidate = xChild->getParentNode(); + if (xObjectCandidate->getNodeName() == "object") + { + OUString sImageId = xChild->getFirstChild()->getNodeValue(); + + css::uno::Reference<css::xml::dom::XNode> xRootCandidate = xChild->getParentNode(); + while (xRootCandidate) + { + if (xRootCandidate->getNodeName() == "interface") + break; + xRootCandidate = xRootCandidate->getParentNode(); + } + + css::uno::Reference<css::xml::dom::XNode> xImageNode; + + for (auto xImageCandidate = xRootCandidate->getFirstChild(); xImageCandidate.is(); xImageCandidate= xImageCandidate->getNextSibling()) + { + css::uno::Reference<css::xml::dom::XNamedNodeMap> xImageCandidateMap = xImageCandidate->getAttributes(); + if (!xImageCandidateMap.is()) + continue; + css::uno::Reference<css::xml::dom::XNode> xId = xImageCandidateMap->getNamedItem("id"); + if (xId && xId->getNodeValue() == sImageId) + { + xImageNode = xImageCandidate; + break; + } + } + + auto xDoc = xChild->getOwnerDocument(); + css::uno::Reference<css::xml::dom::XElement> xImageChild = xDoc->createElement("child"); + xImageChild->appendChild(xImageNode->getParentNode()->removeChild(xImageNode)); + xObjectCandidate->appendChild(xImageChild); + } + + xRemoveList.push_back(xChild); + } + } + if (sName == "draw-indicator") { assert(toBool(xChild->getFirstChild()->getNodeValue())); @@ -19088,7 +19132,8 @@ void GtkInstanceWidget::help_hierarchy_foreach(const std::function<bool(const OS weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) { #if GTK_CHECK_VERSION(4, 0, 0) - if (rUIFile != "cui/ui/percentdialog.ui" && + if (rUIFile != "cui/ui/hyphenate.ui" && + rUIFile != "cui/ui/percentdialog.ui" && rUIFile != "sfx/ui/querysavedialog.ui" && rUIFile != "svt/ui/javadisableddialog.ui" && rUIFile != "modules/smath/ui/fontsizedialog.ui" && _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits