X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f4322df68b099e5e983acc0a3dad4ad5841b57b5..198be845897a79ba350ae7f93db536ddb2eccfb2:/src/gtk/settings.cpp?ds=sidebyside diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index ff3abce216..35cdbec50e 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -126,7 +126,7 @@ static bool GetColourFromGTKWidget(GdkColor& gdkColor, } } - gtk_widget_destroy( widget ); + gtk_object_sink((GtkObject*)widget); return ok; } @@ -135,19 +135,24 @@ static void GetTooltipColors() { GtkTooltips* tooltips = gtk_tooltips_new(); gtk_tooltips_force_window(tooltips); - gtk_widget_ensure_style(tooltips->tip_window); - GdkColor c = tooltips->tip_window->style->bg[GTK_STATE_NORMAL]; - gs_objects.m_colTooltip = wxColor(c); - c = tooltips->tip_window->style->fg[GTK_STATE_NORMAL]; - gs_objects.m_colTooltipText = wxColor(c); -#if GTK_CHECK_VERSION(2, 9, 0) - if (gtk_check_version(2, 9, 0) == NULL) - g_object_ref_sink(tooltips); + + // FIXME: In 2.11.6 tip_window is private and always NULL so + // we need to do something different if there is no window. + // See https://sourceforge.net/tracker/index.php?func=detail&aid=1767485&group_id=9863&atid=109863 + if (tooltips->tip_window) + { + gtk_widget_ensure_style(tooltips->tip_window); + GdkColor c = tooltips->tip_window->style->bg[GTK_STATE_NORMAL]; + gs_objects.m_colTooltip = wxColor(c); + c = tooltips->tip_window->style->fg[GTK_STATE_NORMAL]; + gs_objects.m_colTooltipText = wxColor(c); + } else -#endif { - gtk_object_sink((GtkObject*)tooltips); + gs_objects.m_colTooltipText = wxColour(255, 255, 128); // FIXME } + + gtk_object_sink((GtkObject*)tooltips); } wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) @@ -355,7 +360,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) gs_objects.m_fontSystem = wxFont(wxString::FromAscii(font_name)); g_free (font_name); } - gtk_widget_destroy( widget ); + gtk_object_sink((GtkObject*)widget); } font = gs_objects.m_fontSystem; break;