Index: libxfce4panel/xfce-panel-external-item.c =================================================================== --- libxfce4panel/xfce-panel-external-item.c (revision 24752) +++ libxfce4panel/xfce-panel-external-item.c (working copy) @@ -133,6 +133,12 @@ iface->configure = xfce_external_panel_item_configure; } +static gboolean +xfce_external_panel_item_expose(GtkWidget *widget, GdkEventExpose *event) +{ + return GTK_WIDGET_CLASS(xfce_external_panel_item_parent_class)->expose_event(widget, event); +} + static void xfce_external_panel_item_class_init (XfceExternalPanelItemClass * klass) { @@ -146,6 +152,8 @@ object_class->finalize = xfce_external_panel_item_finalize; + widget_class->expose_event = xfce_external_panel_item_expose; + widget_class->button_press_event = xfce_external_panel_item_button_press_event; } @@ -166,6 +174,8 @@ priv->to_be_removed = FALSE; priv->restart = FALSE; priv->file = NULL; + + gtk_widget_set_app_paintable(GTK_WIDGET(item), TRUE); } /* GObject */ Index: libxfce4panel/xfce-panel-external-plugin.c =================================================================== --- libxfce4panel/xfce-panel-external-plugin.c (revision 24752) +++ libxfce4panel/xfce-panel-external-plugin.c (working copy) @@ -36,6 +36,8 @@ #include "xfce-panel-external-plugin.h" #include "xfce-panel-plugin-messages.h" +#define ALPHA 0.2 + #define XFCE_EXTERNAL_PANEL_PLUGIN_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFCE_TYPE_EXTERNAL_PANEL_PLUGIN, \ XfceExternalPanelPluginPrivate)) @@ -174,18 +176,52 @@ iface->set_panel_hidden = xfce_external_panel_plugin_set_panel_hidden; } +static gboolean +xfce_external_panel_plugin_expose(GtkWidget *widget, GdkEventExpose *event) +{ + cairo_t *cr; + GtkStyle *style; + double r,g,b; + + cr = gdk_cairo_create (widget->window); + + cairo_rectangle (cr, event->area.x, + event->area.y, + event->area.width, + event->area.height); + cairo_clip (cr); + + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + + /* fully transparent */ + style = gtk_widget_get_style (widget); + r = (double) style->bg[widget->state].red / (double) 65535; + g = (double) style->bg[widget->state].green / (double) 65535; + b = (double) style->bg[widget->state].blue / (double) 65535; + cairo_set_source_rgba (cr, r, g, b, ALPHA); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_paint (cr); + + cairo_destroy (cr); + + return GTK_WIDGET_CLASS(xfce_external_panel_plugin_parent_class)->expose_event(widget, event); +} + static void xfce_external_panel_plugin_class_init (XfceExternalPanelPluginClass * klass) { GObjectClass *object_class; + GtkWidgetClass *widget_class; g_type_class_add_private (klass, sizeof (XfceExternalPanelPluginPrivate)); object_class = (GObjectClass *) klass; + widget_class = (GtkWidgetClass *) klass; object_class->finalize = xfce_external_panel_plugin_finalize; object_class->get_property = xfce_external_panel_plugin_get_property; object_class->set_property = xfce_external_panel_plugin_set_property; + widget_class->expose_event = xfce_external_panel_plugin_expose; /* properties */ @@ -219,6 +255,27 @@ priv->construct = NULL; priv->socket_id = 0; priv->expand = FALSE; + + { + GtkWidget *widget; + GdkScreen *screen; + GdkColormap *colormap; + + widget = GTK_WIDGET (plugin); + + gtk_widget_set_app_paintable(widget, TRUE); + + screen = gtk_widget_get_screen (widget); + colormap = gdk_screen_get_rgba_colormap (screen); + + if (!colormap) + { + colormap = gdk_screen_get_rgb_colormap (screen); + g_debug (" No Alpha support \n"); + } + + gtk_widget_set_colormap (widget, colormap); + } } /* GObject */ Index: libxfce4panel/xfce-panel-window.c =================================================================== --- libxfce4panel/xfce-panel-window.c (revision 24752) +++ libxfce4panel/xfce-panel-window.c (working copy) @@ -36,9 +36,10 @@ (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFCE_TYPE_PANEL_WINDOW, \ XfcePanelWindowPrivate)) -#define DEFAULT_ORIENTATION GTK_ORIENTATION_HORIZONTAL -#define DEFAULT_HANDLE_STYLE XFCE_HANDLE_STYLE_BOTH -#define HANDLE_WIDTH 8 +#define DEFAULT_ORIENTATION GTK_ORIENTATION_HORIZONTAL +#define DEFAULT_HANDLE_STYLE XFCE_HANDLE_STYLE_BOTH +#define HANDLE_WIDTH 8 +#define ALPHA 0.2 enum { @@ -353,6 +354,26 @@ priv->right_border = TRUE; priv->movable = TRUE; + { + GtkWidget *widget; + GdkScreen *screen; + GdkColormap *colormap; + + widget = GTK_WIDGET (panel_window); + + gtk_widget_set_app_paintable(widget, TRUE); + + screen = gtk_widget_get_screen (widget); + colormap = gdk_screen_get_rgba_colormap (screen); + + if (!colormap) + { + colormap = gdk_screen_get_rgb_colormap (screen); + g_debug (" No Alpha support \n"); + } + + gtk_widget_set_colormap (widget, colormap); + } gtk_widget_set_events (GTK_WIDGET (panel_window), gtk_widget_get_events (GTK_WIDGET (panel_window)) | GDK_BUTTON_MOTION_MASK @@ -462,20 +483,31 @@ /* drawing, size and style */ static void -_panel_window_paint_border (XfcePanelWindow * panel) +_panel_window_paint_border (XfcePanelWindow * panel, cairo_t *cr) { - XfcePanelWindowPrivate *priv = XFCE_PANEL_WINDOW_GET_PRIVATE (panel); - GdkWindow *window = GTK_WIDGET (panel)->window; - GtkAllocation *a = &(GTK_WIDGET (panel)->allocation); - GtkStyle *style = GTK_WIDGET (panel)->style; - GtkStateType state_type = GTK_WIDGET_STATE (GTK_WIDGET (panel)); - int top, bottom, left, right; + XfcePanelWindowPrivate *priv = XFCE_PANEL_WINDOW_GET_PRIVATE (panel); +// GdkWindow *window = GTK_WIDGET (panel)->window; + GtkAllocation *a = &(GTK_WIDGET (panel)->allocation); + GtkStyle *style = GTK_WIDGET (panel)->style; +// GtkStateType state_type = GTK_WIDGET_STATE (GTK_WIDGET (panel)); + int top, bottom, left, right; + double r, g, b; + GtkWidget *widget = GTK_WIDGET (panel); - top = priv->top_border ? style->ythickness : 0; - bottom = priv->bottom_border ? style->ythickness : 0; - left = priv->left_border ? style->xthickness : 0; - right = priv->right_border ? style->xthickness : 0; - + top = priv->top_border ? 1 /*style->ythickness*/ : 0; + bottom = priv->bottom_border ? 1 /*style->ythickness*/ : 0; + left = priv->left_border ? 1 /*style->xthickness*/ : 0; + right = priv->right_border ? 1 /*style->xthickness*/ : 0; + + cairo_set_line_width (cr, /* top > 1 ? 2.0 :*/ 1.0); + cairo_rectangle (cr, a->x, a->y, a->width, a->height); + + r = (double) style->dark[widget->state].red / (double) 65535; + g = (double) style->dark[widget->state].green / (double) 65535; + b = (double) style->dark[widget->state].blue / (double) 65535; + cairo_set_source_rgba (cr, r, g, b, ALPHA); + cairo_stroke (cr); +#if 0 /* Code based on gtk-xfce-engine-2 */ /* Attempt to explain the code below with some ASCII 'art' @@ -615,17 +647,40 @@ x1, y1, x1, y2); } } +#endif } static gint xfce_panel_window_expose (GtkWidget * widget, GdkEventExpose * event) { - XfcePanelWindow *panel_window = XFCE_PANEL_WINDOW (widget); + cairo_t *cr; + GtkStyle *style; + double r,g,b; + XfcePanelWindow *panel_window = XFCE_PANEL_WINDOW (widget); XfcePanelWindowPrivate *priv = XFCE_PANEL_WINDOW_GET_PRIVATE (panel_window); if (GTK_WIDGET_DRAWABLE (widget)) { + cr = gdk_cairo_create (widget->window); + + cairo_rectangle (cr, event->area.x, + event->area.y, + event->area.width, + event->area.height); + cairo_clip (cr); + + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + + /* fully transparent */ + style = gtk_widget_get_style (widget); + r = (double) style->bg[widget->state].red / (double) 65535; + g = (double) style->bg[widget->state].green / (double) 65535; + b = (double) style->bg[widget->state].blue / (double) 65535; + cairo_set_source_rgba (cr, r, g, b, ALPHA); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_paint (cr); + if (GTK_BIN (widget)->child) { gtk_container_propagate_expose (GTK_CONTAINER (widget), @@ -648,7 +703,9 @@ break; } - _panel_window_paint_border (panel_window); + _panel_window_paint_border (panel_window, cr); + + cairo_destroy (cr); } return FALSE; @@ -671,21 +728,21 @@ } if (priv->top_border) - requisition->height += widget->style->ythickness; + requisition->height += 1; //widget->style->ythickness; if (priv->bottom_border) - requisition->height += widget->style->ythickness; + requisition->height += 1; //widget->style->ythickness; if (priv->left_border) - requisition->width += widget->style->xthickness; + requisition->width += 1; //widget->style->xthickness; if (priv->right_border) - requisition->width += widget->style->xthickness; + requisition->width += 1; //widget->style->xthickness; if (GTK_ORIENTATION_HORIZONTAL == priv->orientation) { - thick = 2 * widget->style->xthickness; + thick = 2; // * widget->style->xthickness; } else { - thick = 2 * widget->style->ythickness; + thick = 2; // * widget->style->ythickness; } switch (priv->handle_style) @@ -749,9 +806,9 @@ int start_handle_size, end_handle_size, thick; if (GTK_ORIENTATION_HORIZONTAL == priv->orientation) - thick = 2 * widget->style->xthickness; + thick = 2; // * widget->style->xthickness; else - thick = 2 * widget->style->ythickness; + thick = 2; // * widget->style->ythickness; start_handle_size = end_handle_size = 0; @@ -774,21 +831,21 @@ if (priv->top_border) { - childalloc.y += widget->style->ythickness; - childalloc.height -= widget->style->ythickness; + childalloc.y += 1; //widget->style->ythickness; + childalloc.height -= 1; //widget->style->ythickness; } if (priv->bottom_border) - childalloc.height -= widget->style->ythickness; + childalloc.height -= 1; //widget->style->ythickness; if (priv->left_border) { - childalloc.x += widget->style->xthickness; - childalloc.width -= widget->style->xthickness; + childalloc.x += 1; //widget->style->xthickness; + childalloc.width -= 1; //widget->style->xthickness; } if (priv->right_border) - childalloc.width -= widget->style->xthickness; + childalloc.width -= 1; //widget->style->xthickness; if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { @@ -922,8 +979,8 @@ int x, y, w, h, xthick, ythick; gboolean horizontal = priv->orientation == GTK_ORIENTATION_HORIZONTAL; - xthick = widget->style->xthickness; - ythick = widget->style->ythickness; + xthick = 1; //widget->style->xthickness; + ythick = 1; //widget->style->ythickness; if (horizontal) { Index: libxfce4panel/xfce-panel-internal-plugin.c =================================================================== --- libxfce4panel/xfce-panel-internal-plugin.c (revision 24752) +++ libxfce4panel/xfce-panel-internal-plugin.c (working copy) @@ -33,6 +33,8 @@ #include "xfce-panel-plugin-iface-private.h" #include "xfce-panel-plugin-iface.h" +#define ALPHA 0.2 + #define XFCE_INTERNAL_PANEL_PLUGIN_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFCE_TYPE_INTERNAL_PANEL_PLUGIN, \ XfceInternalPanelPluginPrivate)) @@ -200,10 +202,39 @@ iface->focus_panel = xfce_internal_panel_plugin_focus_panel; } +static gboolean +xfce_internal_panel_plugin_expose(GtkWidget *widget, GdkEventExpose *event) +{ + cairo_t *cr; + GtkStyle *style; + double r,g,b; + + cr = gdk_cairo_create (widget->window); + + cairo_rectangle (cr, event->area.x, + event->area.y, + event->area.width, + event->area.height); + cairo_clip (cr); + + style = gtk_widget_get_style (widget); + r = (double) style->bg[widget->state].red / (double) 65535; + g = (double) style->bg[widget->state].green / (double) 65535; + b = (double) style->bg[widget->state].blue / (double) 65535; + cairo_set_source_rgba (cr, r, g, b, ALPHA); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_paint (cr); + + cairo_destroy (cr); + + return GTK_WIDGET_CLASS(xfce_internal_panel_plugin_parent_class)->expose_event(widget, event); +} + static void xfce_internal_panel_plugin_class_init (XfceInternalPanelPluginClass * klass) { GObjectClass *object_class; + GtkWidgetClass *widget_class; g_type_class_add_private (klass, sizeof (XfceInternalPanelPluginPrivate)); @@ -213,6 +244,10 @@ object_class->get_property = xfce_internal_panel_plugin_get_property; object_class->set_property = xfce_internal_panel_plugin_set_property; + widget_class = (GtkWidgetClass *) klass; + + widget_class->expose_event = xfce_internal_panel_plugin_expose; + /* properties */ g_object_class_override_property (object_class, PROP_NAME, "name"); @@ -243,6 +278,8 @@ priv->size = 0; priv->screen_position = XFCE_SCREEN_POSITION_NONE; priv->expand = FALSE; + + gtk_widget_set_app_paintable(GTK_WIDGET(plugin), TRUE); } /* GObject */ Index: plugins/separator/separator.c =================================================================== --- plugins/separator/separator.c (revision 24752) +++ plugins/separator/separator.c (working copy) @@ -31,8 +31,9 @@ #include #define SEPARATOR_WIDTH 10 -#define SEP_START 0.15 -#define SEP_END 0.85 +#define SEP_START 0.0 +#define SEP_END 1.0 +#define ALPHA 0.2 static void separator_properties_dialog (XfcePanelPlugin *plugin); @@ -56,32 +57,65 @@ if (GTK_WIDGET_DRAWABLE (widget)) { GtkAllocation *allocation = &(widget->allocation); - int start, end, position; + int start, end, position; + cairo_t *cr; + GtkStyle *style; + double r,g,b; + style = gtk_widget_get_style (widget); + cr = gdk_cairo_create (widget->window); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + + cairo_rectangle (cr, event->area.x, + event->area.y, + event->area.width, + event->area.height); + cairo_clip (cr); + + r = (double) style->bg[widget->state].red / (double) 65535; + g = (double) style->bg[widget->state].green / (double) 65535; + b = (double) style->bg[widget->state].blue / (double) 65535; + cairo_set_source_rgba (cr, r, g, b, ALPHA); + cairo_paint (cr); + + r = (double) style->dark[widget->state].red / (double) 65535; + g = (double) style->dark[widget->state].green / (double) 65535; + b = (double) style->dark[widget->state].blue / (double) 65535; + cairo_set_source_rgba (cr, r, g, b, 1.0 - ((1.0 - ALPHA) / 3)); + if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL) { start = allocation->y + SEP_START * allocation->height; end = allocation->y + SEP_END * allocation->height; position = allocation->x + allocation->width / 2; - - gtk_paint_vline (widget->style, widget->window, + + cairo_move_to (cr, position, start); + cairo_line_to (cr, position, end); + +/* gtk_paint_vline (widget->style, widget->window, GTK_STATE_NORMAL, &(event->area), widget, "separator", start, end, position); - } +*/ } else { start = allocation->x + SEP_START * allocation->width; end = allocation->x + SEP_END * allocation->width; position = allocation->y + allocation->height / 2; - gtk_paint_hline (widget->style, widget->window, + cairo_move_to (cr, start, position); + cairo_line_to (cr, end, position); + +/* gtk_paint_hline (widget->style, widget->window, GTK_STATE_NORMAL, &(event->area), widget, "separator", start, end, position); - } +*/ } + cairo_stroke (cr); + cairo_destroy (cr); + return TRUE; } @@ -91,12 +125,28 @@ static void separator_add_widget (XfcePanelPlugin *plugin) { - GtkWidget *widget; + GtkWidget *widget; + GdkScreen *screen; + GdkColormap *colormap; widget = gtk_drawing_area_new (); + + gtk_widget_set_app_paintable(widget, TRUE); + + screen = gtk_widget_get_screen (widget); + colormap = gdk_screen_get_rgba_colormap (screen); + + if (!colormap) + { + colormap = gdk_screen_get_rgb_colormap (screen); + g_debug (" No Alpha support \n"); + } + + gtk_widget_set_colormap (widget, colormap); + gtk_widget_show (widget); gtk_container_add (GTK_CONTAINER (plugin), widget); - + g_signal_connect (widget, "expose-event", G_CALLBACK (separator_expose), plugin); }