From b7d2033dff3f68d6ac67290c8b90203906e6762f Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Thu, 6 Jul 2017 00:21:09 -0400 Subject: Fix GTK theme image bg support on vertical panel Themers can use the .vertical and .horizontal style classes to rotate a background on vertical panels the same way scrollbars are themed. Apply these style classes to PanelPlugs too so this can actually be used. --- libmate-panel-applet/mate-panel-applet.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index f036b6ec..a1cbc225 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -1533,6 +1533,8 @@ mate_panel_applet_change_background(MatePanelApplet *applet, GdkRGBA* color, cairo_pattern_t *pattern) { + GtkStyleContext* context; + MatePanelAppletOrient orientation; GdkWindow* window = gtk_widget_get_window (applet->priv->plug); gtk_widget_set_app_paintable(GTK_WIDGET(applet),TRUE); _mate_panel_applet_apply_css(GTK_WIDGET(applet->priv->plug),type); @@ -1553,6 +1555,15 @@ mate_panel_applet_change_background(MatePanelApplet *applet, g_assert_not_reached (); break; } + context = gtk_widget_get_style_context (GTK_WIDGET(applet->priv->plug)); + orientation = mate_panel_applet_get_orient (applet); + if (applet->priv->orient == MATE_PANEL_APPLET_ORIENT_UP || + applet->priv->orient == MATE_PANEL_APPLET_ORIENT_DOWN){ + gtk_style_context_add_class(context,"horizontal"); + } + else { + gtk_style_context_add_class(context,"vertical"); + } } #else static void @@ -1561,6 +1572,8 @@ mate_panel_applet_change_background(MatePanelApplet *applet, GdkRGBA* color, cairo_pattern_t *pattern) { + GtkStyleContext* context; + MatePanelAppletOrient orientation; GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(applet)); gtk_widget_set_app_paintable(GTK_WIDGET(applet),TRUE); _mate_panel_applet_apply_css(GTK_WIDGET(applet->priv->plug),type); @@ -1578,6 +1591,15 @@ mate_panel_applet_change_background(MatePanelApplet *applet, g_assert_not_reached (); break; } + context = gtk_widget_get_style_context (GTK_WIDGET(applet->priv->plug)); + orientation = mate_panel_applet_get_orient (applet); + if (applet->priv->orient == MATE_PANEL_APPLET_ORIENT_UP || + applet->priv->orient == MATE_PANEL_APPLET_ORIENT_DOWN){ + gtk_style_context_add_class(context,"horizontal"); + } + else { + gtk_style_context_add_class(context,"vertical"); + } } #endif -- cgit v1.2.1