From 91df075d62606ee295932f1dfefc98187b5ce839 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Thu, 30 Jun 2016 08:39:07 -0400 Subject: [PATCH] Fix input styling with Adwaita 3.20 theme --- src/fe-gtk/fe-gtk.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 3e7b8499..325691bf 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -254,6 +254,22 @@ const char cursor_color_rc[] = "}" "widget \"*.hexchat-inputbox\" style : application \"xc-ib-st\""; +static const char adwaita_workaround_rc[] = + "style \"hexchat-input-workaround\"" + "{" + "engine \"pixmap\" {" + "image {" + "function = FLAT_BOX\n" + "state = NORMAL\n" + "}" + "image {" + "function = FLAT_BOX\n" + "state = ACTIVE\n" + "}" + "}" + "}" + "widget \"*.hexchat-inputbox\" style \"hexchat-input-workaround\""; + GtkStyle * create_input_style (GtkStyle *style) { @@ -274,6 +290,16 @@ create_input_style (GtkStyle *style) if (prefs.hex_gui_input_style && !done_rc) { + GtkSettings *settings = gtk_settings_get_default (); + char *theme_name; + + /* gnome-themes-standard 3.20 relies on images to do theming + * so we have to override that. */ + g_object_get (settings, "gtk-theme-name", &theme_name, NULL); + if (!g_strcmp0 (theme_name, "Adwaita")) + gtk_rc_parse_string (adwaita_workaround_rc); + g_free (theme_name); + done_rc = TRUE; sprintf (buf, cursor_color_rc, (colors[COL_FG].red >> 8), (colors[COL_FG].green >> 8), (colors[COL_FG].blue >> 8));