From e4d45d7212088f9ff5845135c83d21ef3042dda7 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Tue, 19 Jan 2016 16:57:33 -0500 Subject: GTK3: More panel BG rendering bugfixes Keep the .mate-panel-menu-bar and .gnome-panel-menu-bar style classes on the panel toplevel unconditionally. GTK Inspector showed that the toplevel was actually being themed by PanelWidget and not by PanelToplevel, causing multiple issues. This was why it was not possible to set an image or an alpha background in the GTK theme. The .mate-custom-panel-background style class was being applied to the toplevel, but not mate-panel-menu-bar and .gnome-panel-menu-bar . This was also why resetting the panel from a custom to a system background required restarting the panel. I found all of this because of a bug or changed feature (not sure which) in GTK 3.19.7 which prevented the panel from being themed at all. Fixing this right also fixes all the bugs mentioned above. First restart after setting a custom theme will sometimes but not reliably crash an applet, not sure if that is a pre-existing bug though. At any rate, setting ANY custom background was just broken by gtk3.19.7. don't know if they will fix that or we will have to. That one can wait. --- mate-panel/panel-toplevel.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mate-panel') diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index d4ae5ea9..680ae42b 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -5000,6 +5000,15 @@ panel_toplevel_init (PanelToplevel *toplevel) * happens with "alternative" window managers such as Sawfish or XFWM4. */ g_signal_connect(GTK_WIDGET(toplevel), "delete-event", G_CALLBACK(gtk_true), NULL); + +#if GTK_CHECK_VERSION (3, 0, 0) + /*ensure the panel BG can always be themed*/ + /*Without this gtk3.19/20 cannot set the BG color and resetting the bg to system is not immediately applied*/ + GtkStyleContext *context; + context = gtk_widget_get_style_context (toplevel); + gtk_style_context_add_class(context,"gnome-panel-menu-bar"); + gtk_style_context_add_class(context,"mate-panel-menu-bar"); +#endif } PanelWidget * -- cgit v1.2.1