summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-15 16:05:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-15 18:12:21 +0200
commitd00a65466346b47645faf5826f8c8eb5a91f031b (patch)
treee2a42ea60c577c42d7283fafcf5fd14b1d9bf330
parent4364dc21ee184da9f773efbf7b9177d59f5096f1 (diff)
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@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx14
1 files changed, 10 insertions, 4 deletions
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);