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);
|
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||||
GdkRGBA *fc, *bc;
|
GdkRGBA *fc, *bc;
|
||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
|
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);
|
||||||
|
@@ -156,6 +156,7 @@ static void get_color(const char* name, GtkWidget* widget, GtkStateFlags state,
|
|||||||
{
|
{
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||||
GdkRGBA* rgba;
|
GdkRGBA* rgba;
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
||||||
gdkRGBA = *rgba;
|
gdkRGBA = *rgba;
|
||||||
gdk_rgba_free(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()));
|
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||||
sc = gtk_widget_get_style_context(widget);
|
sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
||||||
gdkRGBA = *rgba;
|
gdkRGBA = *rgba;
|
||||||
gdk_rgba_free(rgba);
|
gdk_rgba_free(rgba);
|
||||||
@@ -448,6 +450,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(ButtonWidget());
|
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_context_get(sc, GTK_STATE_FLAG_NORMAL,
|
||||||
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||||
#else
|
#else
|
||||||
|
@@ -194,7 +194,7 @@ wxSize wxSpinButton::DoGetBestSize() const
|
|||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(m_widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(m_widget);
|
||||||
GtkBorder pad = { 0, 0, 0, 0 };
|
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;
|
best.x -= pad.left + pad.right;
|
||||||
#else
|
#else
|
||||||
gtk_widget_ensure_style(m_widget);
|
gtk_widget_ensure_style(m_widget);
|
||||||
|
@@ -1835,6 +1835,7 @@ void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style)
|
|||||||
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_set_state(context, selectedFocused);
|
||||||
gtk_style_context_get(context, selectedFocused,
|
gtk_style_context_get(context, selectedFocused,
|
||||||
"color", &fg_orig, "background-color", &bg_orig,
|
"color", &fg_orig, "background-color", &bg_orig,
|
||||||
NULL);
|
NULL);
|
||||||
|
@@ -452,6 +452,7 @@ void wxPizza::get_border(GtkBorder& border)
|
|||||||
else
|
else
|
||||||
sc = gtk_widget_get_style_context(wxGTKPrivate::GetEntryWidget());
|
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);
|
gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border);
|
||||||
#else // !__WXGTK3__
|
#else // !__WXGTK3__
|
||||||
GtkStyle* style;
|
GtkStyle* style;
|
||||||
|
@@ -373,6 +373,7 @@ 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_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);
|
||||||
gdk_cairo_set_source_rgba(cr, c);
|
gdk_cairo_set_source_rgba(cr, c);
|
||||||
gdk_rgba_free(c);
|
gdk_rgba_free(c);
|
||||||
@@ -4561,6 +4562,7 @@ 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_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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user