diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index 20cd746365..f11b6e80ed 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -251,6 +251,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, } GtkStyleContext* sc = gtk_widget_get_style_context(widget); GdkRGBA c; + gtk_style_context_set_state(sc, stateFlag); gtk_style_context_get_color(sc, stateFlag, &c); attr.colFg = wxColour(c); gtk_style_context_get_background_color(sc, stateFlag, &c); diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 0f5f4de5fe..33b0a07752 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -155,33 +155,39 @@ static GtkWidget* ToolTipWidget() static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) { GtkStyleContext* sc = gtk_widget_get_style_context(widget); + gtk_style_context_set_state(sc, state); gtk_style_context_get_background_color(sc, state, &gdkRGBA); if (gdkRGBA.alpha <= 0) { 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_background_color(sc, state, &gdkRGBA); } } static void fg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) { GtkStyleContext* sc = gtk_widget_get_style_context(widget); + gtk_style_context_set_state(sc, state); gtk_style_context_get_color(sc, state, &gdkRGBA); if (gdkRGBA.alpha <= 0) { 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_color(sc, state, &gdkRGBA); } } static void border(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) { GtkStyleContext* sc = gtk_widget_get_style_context(widget); + gtk_style_context_set_state(sc, state); gtk_style_context_get_border_color(sc, state, &gdkRGBA); if (gdkRGBA.alpha <= 0) { 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_border_color(sc, state, &gdkRGBA); } } @@ -453,6 +459,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 diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index a2285fbce3..97f3461af3 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -196,7 +196,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); diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 5f4f134da5..8ef85e6f84 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1828,6 +1828,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_color(context, selectedFocused, &fg_orig); gtk_style_context_get_background_color(context, selectedFocused, &bg_orig); if (IsMultiLine()) diff --git a/src/gtk/win_gtk.cpp b/src/gtk/win_gtk.cpp index 90ff180ec1..d243c0d0f2 100644 --- a/src/gtk/win_gtk.cpp +++ b/src/gtk/win_gtk.cpp @@ -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; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a1619c5d0e..8920d55a22 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -304,6 +304,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_border_color(sc, GTK_STATE_FLAG_NORMAL, &c); gdk_cairo_set_source_rgba(cr, &c); cairo_set_line_width(cr, 1); @@ -4443,6 +4444,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); }