From c5c040008935e82acf0aa652f41fc8f6c6931e48 Mon Sep 17 00:00:00 2001 From: Denis Gorodnichev Date: Sat, 14 Feb 2015 00:02:12 +0300 Subject: na: fix background transparency --- applets/notification_area/main.c | 41 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'applets') diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index c17fb446..0f3d211b 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -45,6 +45,18 @@ struct _NaTrayAppletPrivate G_DEFINE_TYPE (NaTrayApplet, na_tray_applet, PANEL_TYPE_APPLET) +static void (*parent_class_realize) (GtkWidget *widget); +static void (*parent_class_unrealize) (GtkWidget *widget); +#if GTK_CHECK_VERSION (3, 0, 0) +static void (*parent_class_style_updated) (GtkWidget *widget); +static void (*parent_class_change_background)(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t* pattern); +#else +static void (*parent_class_change_background)(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap); +#endif +static void (*parent_class_change_orient)(MatePanelApplet *panel_applet, MatePanelAppletOrient orient); + + + static GtkOrientation get_gtk_orientation_from_applet_orient (MatePanelAppletOrient orient) { @@ -152,7 +164,8 @@ na_tray_applet_realize (GtkWidget *widget) NaTrayApplet *applet = NA_TRAY_APPLET (widget); MatePanelAppletOrient orient; - GTK_WIDGET_CLASS (na_tray_applet_parent_class)->realize (widget); + if (parent_class_realize) + parent_class_realize (widget); g_assert (applet->priv->tray == NULL); @@ -185,7 +198,8 @@ na_tray_applet_unrealize (GtkWidget *widget) gtk_widget_destroy (GTK_WIDGET (applet->priv->tray)); applet->priv->tray = NULL; - GTK_WIDGET_CLASS (na_tray_applet_parent_class)->unrealize (widget); + if (parent_class_unrealize) + parent_class_unrealize (widget); } #if GTK_CHECK_VERSION (3, 0, 0) @@ -219,7 +233,8 @@ na_tray_applet_style_updated (GtkWidget *widget) gint padding; gint icon_size; - GTK_WIDGET_CLASS (na_tray_applet_parent_class)->style_updated (widget); + if (parent_class_style_updated) + parent_class_style_updated (widget); if (!applet->priv->tray) return; @@ -250,7 +265,7 @@ na_tray_applet_style_updated (GtkWidget *widget) #if GTK_CHECK_VERSION (3, 0, 0) static void -na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkColor* color, cairo_pattern_t* pattern) +na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkRGBA* color, cairo_pattern_t* pattern) #else static void na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap) @@ -258,6 +273,14 @@ na_tray_applet_change_background(MatePanelApplet* panel_applet, MatePanelAppletB { NaTrayApplet *applet = NA_TRAY_APPLET (panel_applet); + if (parent_class_change_background) { +#if GTK_CHECK_VERSION (3, 0, 0) + parent_class_change_background (panel_applet, type, color, pattern); +#else + parent_class_change_background (panel_applet, type, color, pixmap); +#endif + } + if (!applet->priv->tray) return; @@ -270,6 +293,9 @@ na_tray_applet_change_orient (MatePanelApplet *panel_applet, { NaTrayApplet *applet = NA_TRAY_APPLET (panel_applet); + if (parent_class_change_orient) + parent_class_change_orient (panel_applet, orient); + if (!applet->priv->tray) return; @@ -313,12 +339,19 @@ na_tray_applet_class_init (NaTrayAppletClass *class) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); MatePanelAppletClass *applet_class = MATE_PANEL_APPLET_CLASS (class); + parent_class_realize = widget_class->realize; widget_class->realize = na_tray_applet_realize; + + parent_class_unrealize = widget_class->unrealize; widget_class->unrealize = na_tray_applet_unrealize; #if GTK_CHECK_VERSION (3, 0, 0) + parent_class_style_updated = widget_class->style_updated; widget_class->style_updated = na_tray_applet_style_updated; #endif + parent_class_change_background = applet_class->change_background; applet_class->change_background = na_tray_applet_change_background; + + parent_class_change_orient = applet_class->change_orient; applet_class->change_orient = na_tray_applet_change_orient; gtk_widget_class_install_style_property ( -- cgit v1.2.1