Only use underline-rgba property with GTK > 3.16
This avoids glib warnings object class 'GtkTextTag' has no property named 'underline-rgba-set' when calling g_object_get() with older GTK and just avoids doing useless work.
This commit is contained in:
@@ -1924,24 +1924,27 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
|
|||||||
|
|
||||||
wxColour underlineColour = wxNullColour;
|
wxColour underlineColour = wxNullColour;
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
GSList* tags = gtk_text_iter_get_tags(&positioni);
|
if ( wx_is_at_least_gtk3(16) )
|
||||||
for ( GSList* tagp = tags; tagp != NULL; tagp = tagp->next )
|
|
||||||
{
|
{
|
||||||
GtkTextTag* tag = static_cast<GtkTextTag*>(tagp->data);
|
GSList* tags = gtk_text_iter_get_tags(&positioni);
|
||||||
gboolean underlineSet = FALSE;
|
for ( GSList* tagp = tags; tagp != NULL; tagp = tagp->next )
|
||||||
g_object_get(tag, "underline-rgba-set", &underlineSet, NULL);
|
|
||||||
if ( underlineSet )
|
|
||||||
{
|
{
|
||||||
GdkRGBA* gdkColour = NULL;
|
GtkTextTag* tag = static_cast<GtkTextTag*>(tagp->data);
|
||||||
g_object_get(tag, "underline-rgba", &gdkColour, NULL);
|
gboolean underlineSet = FALSE;
|
||||||
if ( gdkColour )
|
g_object_get(tag, "underline-rgba-set", &underlineSet, NULL);
|
||||||
underlineColour = wxColour(*gdkColour);
|
if ( underlineSet )
|
||||||
gdk_rgba_free(gdkColour);
|
{
|
||||||
break;
|
GdkRGBA* gdkColour = NULL;
|
||||||
|
g_object_get(tag, "underline-rgba", &gdkColour, NULL);
|
||||||
|
if ( gdkColour )
|
||||||
|
underlineColour = wxColour(*gdkColour);
|
||||||
|
gdk_rgba_free(gdkColour);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if ( tags )
|
||||||
|
g_slist_free(tags);
|
||||||
}
|
}
|
||||||
if ( tags )
|
|
||||||
g_slist_free(tags);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( underlineType != wxTEXT_ATTR_UNDERLINE_NONE )
|
if ( underlineType != wxTEXT_ATTR_UNDERLINE_NONE )
|
||||||
|
Reference in New Issue
Block a user