From ca242dfefa03016a9b0f675cb91b4605ce80875d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 26 May 2021 17:41:38 +0100 Subject: gtk[3|4] gtk_widget_get_root returns null when no root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- vcl/inc/unx/gtk/gtkdata.hxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'vcl/inc/unx') 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 -- cgit