else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
- // reset the icon
- wxIconBundle iconsOld = win->GetIcons();
- if ( !iconsOld.IsEmpty() )
- {
- win->SetIcon( wxNullIcon );
- win->SetIcons( iconsOld );
- }
+ const wxIconBundle& icons = win->GetIcons();
+ if (icons.GetIconCount())
+ win->SetIcons(icons);
if (win->HasFlag(wxFRAME_SHAPED))
win->SetShape(win->m_shape); // it will really set the window shape now
}
}
-BEGIN_EVENT_TABLE(wxTopLevelWindowGTK, wxTopLevelWindowBase)
- EVT_SYS_COLOUR_CHANGED(wxTopLevelWindowGTK::OnSysColourChanged)
-END_EVENT_TABLE()
-
// ----------------------------------------------------------------------------
// wxTopLevelWindowGTK creation
// ----------------------------------------------------------------------------
}
}
#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON
+
+ g_object_ref(m_widget);
}
wxWindow *topParent = wxGetTopLevelParent(m_parent);
wxTopLevelWindowBase::SetIcons( icons );
- GList *list = NULL;
-
- const size_t numIcons = icons.GetIconCount();
- for ( size_t i = 0; i < numIcons; i++ )
+ // Setting icons before window is realized can cause a GTK assertion if
+ // another TLW is realized before this one, and it has this one as it's
+ // transient parent. The life demo exibits this problem.
+ if (GTK_WIDGET_REALIZED(m_widget))
{
- list = g_list_prepend(list, icons.GetIconByIndex(i).GetPixbuf());
+ GList* list = NULL;
+ for (size_t i = icons.GetIconCount(); i--;)
+ list = g_list_prepend(list, icons.GetIconByIndex(i).GetPixbuf());
+ gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
+ g_list_free(list);
}
-
- gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
- g_list_free(list);
}
// ----------------------------------------------------------------------------
"Composite", &opcode, &event, &error);
#endif
}
-
-void wxTopLevelWindowGTK::OnSysColourChanged(wxSysColourChangedEvent& event)
-{
- // We don't know the order in which top-level windows will
- // be notified, so we need to clear the system objects
- // for each top-level window.
- extern void wxClearGtkSystemObjects();
- wxClearGtkSystemObjects();
-
- // wxWindowBase::OnSysColourChanged will propagate event
- // to children
- event.Skip();
-}