[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 15 16:13:05 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit d00a65466346b47645faf5826f8c8eb5a91f031b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 15 16:05:09 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jun 15 18:12:21 2021 +0200

    gtk4: support moving children in and out of GtkGrid
    
    Change-Id: Ia90b9586ff39f0a668da4e0f9beef7ed26626ebf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117260
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 261744a70351..2f04556c88f1 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -5098,8 +5098,11 @@ public:
 #if !GTK_CHECK_VERSION(4, 0, 0)
         gtk_container_remove(pOldContainer, pChild);
 #else
-        assert(GTK_IS_BOX(pOldContainer));
-        gtk_box_remove(GTK_BOX(pOldContainer), pChild);
+        assert(GTK_IS_BOX(pOldContainer) || GTK_IS_GRID(pOldContainer));
+        if (GTK_IS_BOX(pOldContainer))
+            gtk_box_remove(GTK_BOX(pOldContainer), pChild);
+        else if (GTK_IS_GRID(pOldContainer))
+            gtk_grid_remove(GTK_GRID(pOldContainer), pChild);
 #endif
 
         GtkInstanceContainer* pNewGtkParent = dynamic_cast<GtkInstanceContainer*>(pNewParent);
@@ -5110,8 +5113,11 @@ public:
 #if !GTK_CHECK_VERSION(4, 0, 0)
             gtk_container_add(pNewContainer, pChild);
 #else
-            assert(GTK_IS_BOX(pNewContainer));
-            gtk_box_append(GTK_BOX(pNewContainer), pChild);
+            assert(GTK_IS_BOX(pNewContainer) || GTK_IS_GRID(pNewContainer));
+            if (GTK_IS_BOX(pNewContainer))
+                gtk_box_append(GTK_BOX(pNewContainer), pChild);
+            else if (GTK_IS_GRID(pNewContainer))
+                gtk_grid_attach(GTK_GRID(pNewContainer), pChild, 0, 0, 1, 1);
 #endif
         }
         g_object_unref(pChild);


More information about the Libreoffice-commits mailing list