don't use gtk_window_group_remove_window if widgets are not GtkWindows

Change-Id: I80d01f29091d7cc06e82295e781ef7a53fb7776b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88739
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2020-02-14 17:08:04 +00:00
parent ce16f1f329
commit e30caebf76

View File

@@ -2252,19 +2252,22 @@ const SystemEnvData* GtkSalFrame::GetSystemData() const
void GtkSalFrame::SetParent( SalFrame* pNewParent )
{
GtkWindow* pWindow = GTK_IS_WINDOW(m_pWindow) ? GTK_WINDOW(m_pWindow) : nullptr;
if (m_pParent)
{
gtk_window_group_remove_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)), GTK_WINDOW(m_pWindow));
if (pWindow && GTK_IS_WINDOW(m_pParent->m_pWindow))
gtk_window_group_remove_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)), pWindow);
m_pParent->m_aChildren.remove(this);
}
m_pParent = static_cast<GtkSalFrame*>(pNewParent);
if (m_pParent)
{
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));
if (pWindow && GTK_IS_WINDOW(m_pParent->m_pWindow))
gtk_window_group_add_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)), pWindow);
}
if( ! isChild() )
gtk_window_set_transient_for( GTK_WINDOW(m_pWindow),
if (!isChild() && pWindow)
gtk_window_set_transient_for( pWindow,
(m_pParent && ! m_pParent->isChild(true,false)) ? GTK_WINDOW(m_pParent->m_pWindow) : nullptr
);
}