Avoid "Gtk-WARNING **: State doesn't match"
See https://github.com/wxWidgets/wxWidgets/pull/232
This commit is contained in:
@@ -252,6 +252,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||
GdkRGBA *fc, *bc;
|
||||
wxNativeFontInfo info;
|
||||
gtk_style_context_set_state(sc, stateFlag);
|
||||
gtk_style_context_get(sc, stateFlag,
|
||||
"color", &fc, "background-color", &bc,
|
||||
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||
|
@@ -156,6 +156,7 @@ static void get_color(const char* name, GtkWidget* widget, GtkStateFlags state,
|
||||
{
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||
GdkRGBA* rgba;
|
||||
gtk_style_context_set_state(sc, state);
|
||||
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
||||
gdkRGBA = *rgba;
|
||||
gdk_rgba_free(rgba);
|
||||
@@ -163,6 +164,7 @@ static void get_color(const char* name, GtkWidget* widget, GtkStateFlags state,
|
||||
{
|
||||
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||
sc = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_set_state(sc, state);
|
||||
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
||||
gdkRGBA = *rgba;
|
||||
gdk_rgba_free(rgba);
|
||||
@@ -448,6 +450,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
||||
wxNativeFontInfo info;
|
||||
#ifdef __WXGTK3__
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(ButtonWidget());
|
||||
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
||||
gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL,
|
||||
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||
#else
|
||||
|
@@ -194,7 +194,7 @@ wxSize wxSpinButton::DoGetBestSize() const
|
||||
#ifdef __WXGTK3__
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(m_widget);
|
||||
GtkBorder pad = { 0, 0, 0, 0 };
|
||||
gtk_style_context_get_padding(sc, GtkStateFlags(0), &pad);
|
||||
gtk_style_context_get_padding(sc, gtk_style_context_get_state(sc), &pad);
|
||||
best.x -= pad.left + pad.right;
|
||||
#else
|
||||
gtk_widget_ensure_style(m_widget);
|
||||
|
@@ -1835,6 +1835,7 @@ void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||
gtk_style_context_save(context);
|
||||
gtk_style_context_add_class(context, GTK_STYLE_CLASS_VIEW);
|
||||
}
|
||||
gtk_style_context_set_state(context, selectedFocused);
|
||||
gtk_style_context_get(context, selectedFocused,
|
||||
"color", &fg_orig, "background-color", &bg_orig,
|
||||
NULL);
|
||||
|
@@ -452,6 +452,7 @@ void wxPizza::get_border(GtkBorder& border)
|
||||
else
|
||||
sc = gtk_widget_get_style_context(wxGTKPrivate::GetEntryWidget());
|
||||
|
||||
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
||||
gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border);
|
||||
#else // !__WXGTK3__
|
||||
GtkStyle* style;
|
||||
|
@@ -373,6 +373,7 @@ draw_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win)
|
||||
#ifdef __WXGTK3__
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(win->m_wxwindow);
|
||||
GdkRGBA* c;
|
||||
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
||||
gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "border-color", &c, NULL);
|
||||
gdk_cairo_set_source_rgba(cr, c);
|
||||
gdk_rgba_free(c);
|
||||
@@ -4561,6 +4562,7 @@ void wxWindowGTK::GTKApplyStyle(GtkWidget* widget, GtkRcStyle* WXUNUSED_IN_GTK3(
|
||||
cairo_pattern_t* pattern = NULL;
|
||||
if (m_backgroundColour.IsOk())
|
||||
{
|
||||
gtk_style_context_set_state(context, GTK_STATE_FLAG_NORMAL);
|
||||
gtk_style_context_get(context,
|
||||
GTK_STATE_FLAG_NORMAL, "background-image", &pattern, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user