From 70e5fbcf28fe5eec16f32536adf4b506857d88cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 26 Sep 2019 12:19:57 +0100 Subject: [PATCH] get toplevel GtkWindow if parent is a child frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9645259dd8c7fb331b2efab3f441422ee1f07c12 Reviewed-on: https://gerrit.libreoffice.org/79599 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/unx/gtk3/gtk3gtkframe.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 96be79e3d106..0b1065b13147 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -1073,17 +1073,18 @@ void GtkSalFrame::Init( SalFrame* pParent, SalFrameStyleFlags nStyle ) updateWMClass(); } - if( m_pParent && m_pParent->m_pWindow && ! isChild() ) - gtk_window_set_screen( GTK_WINDOW(m_pWindow), gtk_window_get_screen( GTK_WINDOW(m_pParent->m_pWindow) ) ); - if (GTK_IS_WINDOW(m_pWindow)) { if (m_pParent) { + GtkWidget* pTopLevel = gtk_widget_get_toplevel(m_pParent->m_pWindow); + if (!isChild()) + gtk_window_set_screen(GTK_WINDOW(m_pWindow), gtk_window_get_screen(GTK_WINDOW(pTopLevel))); + if (!(m_pParent->m_nStyle & SalFrameStyleFlags::PLUG)) - gtk_window_set_transient_for( GTK_WINDOW(m_pWindow), GTK_WINDOW(m_pParent->m_pWindow) ); + gtk_window_set_transient_for(GTK_WINDOW(m_pWindow), GTK_WINDOW(pTopLevel)); m_pParent->m_aChildren.push_back( this ); - gtk_window_group_add_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)), GTK_WINDOW(m_pWindow)); + gtk_window_group_add_window(gtk_window_get_group(GTK_WINDOW(pTopLevel)), GTK_WINDOW(m_pWindow)); } else {