avoid gtk_style_context_get_*color(), deprecated in GTK+ 3.16

This commit is contained in:
Paul Cornett
2016-02-08 10:44:18 -08:00
parent f844b45815
commit 94163e48c0
2 changed files with 12 additions and 8 deletions

View File

@@ -1828,22 +1828,25 @@ void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style)
const bool bg_ok = m_backgroundColour.IsOk(); const bool bg_ok = m_backgroundColour.IsOk();
if (fg_ok || bg_ok) if (fg_ok || bg_ok)
{ {
GdkRGBA fg_orig, bg_orig; GdkRGBA *fg_orig, *bg_orig;
GtkStyleContext* context = gtk_widget_get_style_context(m_text); GtkStyleContext* context = gtk_widget_get_style_context(m_text);
if (IsMultiLine()) if (IsMultiLine())
{ {
gtk_style_context_save(context); gtk_style_context_save(context);
gtk_style_context_add_class(context, GTK_STYLE_CLASS_VIEW); gtk_style_context_add_class(context, GTK_STYLE_CLASS_VIEW);
} }
gtk_style_context_get_color(context, selectedFocused, &fg_orig); gtk_style_context_get(context, selectedFocused,
gtk_style_context_get_background_color(context, selectedFocused, &bg_orig); "color", &fg_orig, "background-color", &bg_orig);
if (IsMultiLine()) if (IsMultiLine())
gtk_style_context_restore(context); gtk_style_context_restore(context);
if (fg_ok) if (fg_ok)
gtk_widget_override_color(m_text, selectedFocused, &fg_orig); gtk_widget_override_color(m_text, selectedFocused, fg_orig);
if (bg_ok) if (bg_ok)
gtk_widget_override_background_color(m_text, selectedFocused, &bg_orig); gtk_widget_override_background_color(m_text, selectedFocused, bg_orig);
gdk_rgba_free(fg_orig);
gdk_rgba_free(bg_orig);
} }
#endif // __WXGTK3__ #endif // __WXGTK3__

View File

@@ -372,9 +372,10 @@ draw_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win)
{ {
#ifdef __WXGTK3__ #ifdef __WXGTK3__
GtkStyleContext* sc = gtk_widget_get_style_context(win->m_wxwindow); GtkStyleContext* sc = gtk_widget_get_style_context(win->m_wxwindow);
GdkRGBA c; GdkRGBA* c;
gtk_style_context_get_border_color(sc, GTK_STATE_FLAG_NORMAL, &c); gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "border-color", &c, NULL);
gdk_cairo_set_source_rgba(cr, &c); gdk_cairo_set_source_rgba(cr, c);
gdk_rgba_free(c);
cairo_set_line_width(cr, 1); cairo_set_line_width(cr, 1);
cairo_rectangle(cr, x + 0.5, y + 0.5, w - 1, h - 1); cairo_rectangle(cr, x + 0.5, y + 0.5, w - 1, h - 1);
cairo_stroke(cr); cairo_stroke(cr);