[Libreoffice-commits] core.git: include/vcl vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 14 20:06:48 UTC 2021
include/vcl/builder.hxx | 2 +-
vcl/unx/gtk3/gtkinst.cxx | 24 +++++++++++++++++++++---
2 files changed, 22 insertions(+), 4 deletions(-)
New commits:
commit 2d616d49a0108d06fb972442e15589db9da1681d
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri May 14 12:01:57 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 14 22:06:05 2021 +0200
gtk4: clear parent widget can-focus of False if child has can-focus of true
Change-Id: I44e069f65ca52897f1ca97ab77644cda1a6cea2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115604
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 153d52887d7a..8c276e40e32a 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -442,7 +442,7 @@ inline T* VclBuilder::get(const OString& sID)
/*
* @return true if rValue is "True", "true", "1", etc.
*/
-bool toBool(std::u16string_view rValue);
+VCL_DLLPUBLIC bool toBool(std::u16string_view rValue);
#endif
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index d4b0303207d0..8e3e32b32e56 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17567,15 +17567,17 @@ void SetPropertyOnTopLevel(const Reference<css::xml::dom::XNode>& xNode, const R
}
}
-void ConvertTree(const Reference<css::xml::dom::XNode>& xNode)
+bool ConvertTree(const Reference<css::xml::dom::XNode>& xNode)
{
css::uno::Reference<css::xml::dom::XNodeList> xNodeList = xNode->getChildNodes();
if (!xNodeList.is())
- return;
+ return false;
std::vector<css::uno::Reference<css::xml::dom::XNode>> xRemoveList;
OUString sBorderWidth;
+ bool bChildCanFocus = false;
+ css::uno::Reference<css::xml::dom::XNode> xCantFocus;
css::uno::Reference<css::xml::dom::XNode> xChild = xNode->getFirstChild();
while (xChild.is())
@@ -17617,6 +17619,13 @@ void ConvertTree(const Reference<css::xml::dom::XNode>& xNode)
SetPropertyOnTopLevel(xChild, xDefaultWidget);
}
+ if (sName == "can-focus")
+ {
+ bChildCanFocus = toBool(xChild->getFirstChild()->getNodeValue());
+ if (!bChildCanFocus)
+ xCantFocus = xChild;
+ }
+
if (sName == "type-hint" || sName == "skip-taskbar-hint" ||
sName == "can-default" || sName == "has-default" ||
sName == "border-width" || sName == "layout-style" ||
@@ -17750,7 +17759,14 @@ void ConvertTree(const Reference<css::xml::dom::XNode>& xNode)
auto xNextChild = xChild->getNextSibling();
if (xChild->hasChildNodes())
- ConvertTree(xChild);
+ {
+ bChildCanFocus |= ConvertTree(xChild);
+ if (bChildCanFocus && xCantFocus.is())
+ {
+ xNode->removeChild(xCantFocus);
+ xCantFocus.clear();
+ }
+ }
if (xChild->getNodeName() == "object")
{
@@ -17821,6 +17837,8 @@ void ConvertTree(const Reference<css::xml::dom::XNode>& xNode)
}
for (auto& xRemove : xRemoveList)
xNode->removeChild(xRemove);
+
+ return bChildCanFocus;
}
#endif
More information about the Libreoffice-commits
mailing list