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 <caol...@redhat.com>
AuthorDate: Fri May 14 12:01:57 2021 +0100
Commit:     Caolán McNamara <caol...@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 <caol...@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
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to