vcl/unx/gtk3/gtkinst.cxx |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 237eb44e0397f90c733c98f3680d63c0a9d7645e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed May 26 20:43:33 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu May 27 10:39:36 2021 +0200

    gtk4: drop can't focus from GtkBox and GtkGrid
    
    it used to be that can-focus of true in a child with false in the
    parent allowed focus in the child, that's no longer true. We're
    already clearing can-focus of false from a widget if a child has
    can-focus but we build notebooks (especially) with separate .ui
    files each page so can't tell that there will be contents inserted.
    
    Plenty of ways to target just the case for notebook contents, but seems
    easiest to just clear can-focus of false from all GtkBoxes and GtkGrids.
    
    Change-Id: I460f3d5990a5df7b8b8e7d37ce592a5731794f31
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116226
    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 9044f0cd242b..7000e325b607 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -18530,7 +18530,21 @@ ConvertResult Convert3To4(const 
Reference<css::xml::dom::XNode>& xNode)
             {
                 bChildCanFocus = 
toBool(xChild->getFirstChild()->getNodeValue());
                 if (!bChildCanFocus)
-                    xCantFocus = xChild;
+                {
+                    OUString sParentClass = GetParentObjectType(xChild);
+                    if (sParentClass == "GtkBox" || sParentClass == "GtkGrid")
+                    {
+                        // e.g. for the case of notebooks without children 
yet, just remove the can't focus property
+                        // from Boxes and Grids
+                        xRemoveList.push_back(xChild);
+                    }
+                    else
+                    {
+                        // otherwise mark the property as needing removal if 
there turns out to be a child
+                        // with can-focus of true, in which case remove this 
parent conflicting property
+                        xCantFocus = xChild;
+                    }
+                }
             }
 
             if (sName == "visible")
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to