From c13a63a26ab95d179e47ee57560a68cde06d84b9 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 17 May 2014 17:34:36 +0000 Subject: [PATCH] Fix wxSystemSettings::GetColour() returning transparent colors with GTK3, closes #16255 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/settings.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 98efe96766..0f5f4de5fe 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -156,16 +156,34 @@ static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) { GtkStyleContext* sc = gtk_widget_get_style_context(widget); 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_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_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_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_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_get_border_color(sc, state, &gdkRGBA); + } } wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) @@ -235,14 +253,21 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) break; case wxSYS_COLOUR_ACTIVECAPTION: case wxSYS_COLOUR_MENUHILIGHT: - bg(MenuItemWidget(), GTK_STATE_FLAG_SELECTED, gdkRGBA); + bg(MenuItemWidget(), GTK_STATE_FLAG_PRELIGHT, gdkRGBA); break; case wxSYS_COLOUR_MENUTEXT: fg(MenuItemWidget(), GTK_STATE_FLAG_NORMAL, gdkRGBA); break; case wxSYS_COLOUR_APPWORKSPACE: case wxSYS_COLOUR_WINDOW: - bg(TextCtrlWidget(), GTK_STATE_FLAG_NORMAL, gdkRGBA); + { + GtkWidget* widget = TextCtrlWidget(); + GtkStyleContext* sc = gtk_widget_get_style_context(widget); + gtk_style_context_save(sc); + gtk_style_context_add_class(sc, GTK_STYLE_CLASS_VIEW); + bg(widget, GTK_STATE_FLAG_NORMAL, gdkRGBA); + gtk_style_context_restore(sc); + } break; case wxSYS_COLOUR_CAPTIONTEXT: {