]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Fix input styling with Adwaita 3.20 theme
authorPatrick Griffis <redacted>
Thu, 30 Jun 2016 12:39:07 +0000 (08:39 -0400)
committerPatrick Griffis <redacted>
Tue, 5 Jul 2016 19:26:05 +0000 (15:26 -0400)
src/fe-gtk/fe-gtk.c

index 3e7b8499aa821f6623d7d325951b0a012aa41173..325691bfcb8b595379c0066ce6084963e5f4e562 100644 (file)
@@ -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));