Save and restore GtkStyleContext in a few places that were not doing it
Does not fix any known problem, but seems prudent
(backport of 5d04f41d47
)
This commit is contained in:
@@ -250,6 +250,7 @@ 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 c;
|
GdkRGBA c;
|
||||||
gtk_style_context_set_state(sc, stateFlag);
|
gtk_style_context_set_state(sc, stateFlag);
|
||||||
gtk_style_context_get_color(sc, stateFlag, &c);
|
gtk_style_context_get_color(sc, stateFlag, &c);
|
||||||
@@ -260,6 +261,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|||||||
gtk_style_context_get(
|
gtk_style_context_get(
|
||||||
sc, stateFlag, GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
sc, stateFlag, GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||||
attr.font = wxFont(info);
|
attr.font = wxFont(info);
|
||||||
|
gtk_style_context_restore(sc);
|
||||||
#else
|
#else
|
||||||
GtkStyle* style;
|
GtkStyle* style;
|
||||||
|
|
||||||
|
@@ -304,8 +304,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_border_color(sc, GTK_STATE_FLAG_NORMAL, &c);
|
gtk_style_context_get_border_color(sc, GTK_STATE_FLAG_NORMAL, &c);
|
||||||
|
gtk_style_context_restore(sc);
|
||||||
gdk_cairo_set_source_rgba(cr, &c);
|
gdk_cairo_set_source_rgba(cr, &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);
|
||||||
@@ -4444,9 +4446,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