summaryrefslogtreecommitdiff
path: root/vcl/inc/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-26 17:41:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-26 21:50:21 +0200
commitca242dfefa03016a9b0f675cb91b4605ce80875d (patch)
tree1b877c5ae9cce61b24ff3a7bc252415ed8c5d01c /vcl/inc/unx
parent7768abbf86731a1105fcebe7c2557cb9ac5ba86a (diff)
gtk[3|4] gtk_widget_get_root returns null when no root
unlike gtk_widget_get_toplevel which returns itself if that is the case Change-Id: If977440265bd8ae2c892ee5d52091ebf16ad03cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116218 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/inc/unx')
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index b343021d3d30..5b37adaed263 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -73,10 +73,11 @@ inline void css_provider_load_from_data(GtkCssProvider *css_provider,
#endif
}
-inline GtkWidget* widget_get_root(GtkWidget* pWidget)
+inline GtkWidget* widget_get_toplevel(GtkWidget* pWidget)
{
#if GTK_CHECK_VERSION(4, 0, 0)
- return pWidget ? GTK_WIDGET(gtk_widget_get_root(pWidget)) : nullptr;
+ GtkRoot* pRoot = gtk_widget_get_root(pWidget);
+ return pRoot ? GTK_WIDGET(pRoot) : pWidget;
#else
return gtk_widget_get_toplevel(pWidget);
#endif