[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 24 16:22:23 UTC 2021
vcl/unx/gtk3/gtkinst.cxx | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
New commits:
commit 8e34098774a002a8734d9d03d1ba7cb445b815c4
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 24 16:07:36 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 24 18:21:37 2021 +0200
gtk4: always transform internal-child GtkButtonBox to GtkHeaderBar
except for GtkMessageDialog ones
Change-Id: I7bb1ff1533ebc07872342fdf632f5a950bf73d88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116064
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 90c36c060476..017bf4f76f3d 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -18235,6 +18235,23 @@ Reference<css::xml::dom::XNode> CreateProperty(const css::uno::Reference<css::xm
return xProperty;
}
+bool ToplevelIsMessageDialog(const Reference<css::xml::dom::XNode>& xNode)
+{
+ for (css::uno::Reference<css::xml::dom::XNode> xObjectCandidate = xNode->getParentNode();
+ xObjectCandidate.is();
+ xObjectCandidate = xObjectCandidate->getParentNode())
+ {
+ if (xObjectCandidate->getNodeName() == "object")
+ {
+ css::uno::Reference<css::xml::dom::XNamedNodeMap> xObjectMap = xObjectCandidate->getAttributes();
+ css::uno::Reference<css::xml::dom::XNode> xClass = xObjectMap->getNamedItem("class");
+ if (xClass->getNodeValue() == "GtkMessageDialog")
+ return true;
+ }
+ }
+ return false;
+}
+
void SetPropertyOnTopLevel(const Reference<css::xml::dom::XNode>& xNode, const Reference<css::xml::dom::XNode>& xProperty)
{
for (css::uno::Reference<css::xml::dom::XNode> xObjectCandidate = xNode->getParentNode();
@@ -18582,8 +18599,10 @@ bool ConvertTree(const Reference<css::xml::dom::XNode>& xNode)
OUString sClass(xClass->getNodeValue());
if (sClass == "GtkButtonBox")
{
- css::uno::Reference<css::xml::dom::XNode> xId = xMap->getNamedItem("id");
- if (xId->getNodeValue().startsWith("dialog-action_area"))
+ auto xInternalChildCandidate = xChild->getParentNode();
+ css::uno::Reference<css::xml::dom::XNamedNodeMap> xInternalChildCandidateMap = xInternalChildCandidate->getAttributes();
+ css::uno::Reference<css::xml::dom::XNode> xId = xInternalChildCandidateMap->getNamedItem("internal-child");
+ if (xId && xId->getNodeValue() == "action_area" && !ToplevelIsMessageDialog(xChild))
{
xClass->setNodeValue("GtkHeaderBar");
auto xDoc = xChild->getOwnerDocument();
@@ -18650,7 +18669,7 @@ bool ConvertTree(const Reference<css::xml::dom::XNode>& xNode)
xContentAreaCandidate = xContentAreaCandidate->getParentNode();
}
}
- else // if (!xId->getNodeValue().startsWith("messagedialog-action_area"))
+ else // GtkMessageDialog
xClass->setNodeValue("GtkBox");
}
else if (sClass == "GtkRadioButton")
More information about the Libreoffice-commits
mailing list