Save and restore GtkStyleContext in a few places that were not doing it
Does not fix any known problem, but seems prudent
This commit is contained in:
@@ -250,12 +250,14 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|||||||
stateFlag = GTK_STATE_FLAG_ACTIVE;
|
stateFlag = GTK_STATE_FLAG_ACTIVE;
|
||||||
}
|
}
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_save(sc);
|
||||||
GdkRGBA *fc, *bc;
|
GdkRGBA *fc, *bc;
|
||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
gtk_style_context_set_state(sc, stateFlag);
|
gtk_style_context_set_state(sc, stateFlag);
|
||||||
gtk_style_context_get(sc, stateFlag,
|
gtk_style_context_get(sc, stateFlag,
|
||||||
"color", &fc, "background-color", &bc,
|
"color", &fc, "background-color", &bc,
|
||||||
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||||
|
gtk_style_context_restore(sc);
|
||||||
attr.colFg = wxColour(*fc);
|
attr.colFg = wxColour(*fc);
|
||||||
attr.colBg = wxColour(*bc);
|
attr.colBg = wxColour(*bc);
|
||||||
attr.font = wxFont(info);
|
attr.font = wxFont(info);
|
||||||
|
@@ -373,8 +373,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_save(sc);
|
||||||
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
||||||
gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "border-color", &c, NULL);
|
gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "border-color", &c, NULL);
|
||||||
|
gtk_style_context_restore(sc);
|
||||||
gdk_cairo_set_source_rgba(cr, c);
|
gdk_cairo_set_source_rgba(cr, c);
|
||||||
gdk_rgba_free(c);
|
gdk_rgba_free(c);
|
||||||
cairo_set_line_width(cr, 1);
|
cairo_set_line_width(cr, 1);
|
||||||
@@ -4573,9 +4575,11 @@ void wxWindowGTK::GTKApplyStyle(GtkWidget* widget, GtkRcStyle* WXUNUSED_IN_GTK3(
|
|||||||
cairo_pattern_t* pattern = NULL;
|
cairo_pattern_t* pattern = NULL;
|
||||||
if (m_backgroundColour.IsOk())
|
if (m_backgroundColour.IsOk())
|
||||||
{
|
{
|
||||||
|
gtk_style_context_save(context);
|
||||||
gtk_style_context_set_state(context, GTK_STATE_FLAG_NORMAL);
|
gtk_style_context_set_state(context, GTK_STATE_FLAG_NORMAL);
|
||||||
gtk_style_context_get(context,
|
gtk_style_context_get(context,
|
||||||
GTK_STATE_FLAG_NORMAL, "background-image", &pattern, NULL);
|
GTK_STATE_FLAG_NORMAL, "background-image", &pattern, NULL);
|
||||||
|
gtk_style_context_restore(context);
|
||||||
}
|
}
|
||||||
if (pattern)
|
if (pattern)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user