--- src/themes/ubuntu/theme.c 2007-09-03 18:20:35.000000000 +0100 +++ /home/alex/Desktop/theme.c 2007-09-01 22:49:36.000000000 +0100 @@ -24,6 +24,9 @@ typedef struct /* do we have a arrow and where do we point to */ gboolean has_arrow; + + gboolean enable_transparency; + int point_x; int point_y; @@ -232,8 +235,7 @@ draw_border(GtkWidget *win, GdkEventExpo bg_color.green/65535.0, bg_color.blue/65535.0); - draw_rounded_window(cr, 0, 0, w, h, windata); - cairo_fill(cr); + cairo_paint (cr); // draw a stripe draw_stripe(win, cr, windata); @@ -243,21 +245,34 @@ draw_border(GtkWidget *win, GdkEventExpo 218.0/255.0, 178.0/255.0, 85.0/255.0); - draw_rounded_window(cr, 0.5, 1.5, w-1, h-3, windata); - cairo_set_line_width (cr, 1); - cairo_stroke(cr); + draw_rounded_window (cr, 0, 0, w, h, windata); + // Stroke the border 2 pixels wide so we get a 1 pixel stroke inside our + // path (we'll mask the outside half of it later). + cairo_set_line_width (cr, 2); + cairo_stroke (cr); - // clear the mask + // Clear the shape mask cairo_set_operator (mask_cr, CAIRO_OPERATOR_CLEAR); cairo_paint (mask_cr); - // draw a "black" rounded thing - cairo_set_source_rgba(mask_cr, 1,1,1,1); + // Draw the window shape to the input mask + cairo_set_source_rgba(mask_cr, 1, 1, 1, 1); cairo_set_operator (mask_cr, CAIRO_OPERATOR_OVER); - - draw_rounded_window(mask_cr, 0,1,w,h-2, windata); + draw_rounded_window(mask_cr, 0, 0, w, h, windata); cairo_fill(mask_cr); - gdk_window_shape_combine_mask (win->window, (GdkBitmap *) mask, 0, 0); + + if (windata->enable_transparency) { + // If transparency is enabled, we can mask the drawing itself and just + // use the shape mask as an input mask. + cairo_set_operator (cr, CAIRO_OPERATOR_DEST_IN); + cairo_set_source_rgb (cr, 0, 0, 0); + draw_rounded_window (cr, 0, 0, w, h, windata); + cairo_fill (cr); + gdk_window_input_shape_combine_mask (win->window, (GdkBitmap *) mask, 0, 0); + } else { + // Otherwise, use the shape mask for bilevel visual shaping as well. + gdk_window_shape_combine_mask (win->window, (GdkBitmap *) mask, 0, 0); + } return FALSE; } @@ -305,6 +320,8 @@ create_notification(UrlClickedCb url_cli GtkWidget *image; GtkWidget *alignment; WindowData *windata; + GdkColormap *colormap; + GdkScreen *screen; windata = g_new0(WindowData, 1); windata->urgency = URGENCY_NORMAL; @@ -312,6 +329,18 @@ create_notification(UrlClickedCb url_cli win = gtk_window_new(GTK_WINDOW_POPUP); windata->win = win; + + windata->enable_transparency = FALSE; + screen = gtk_window_get_screen(GTK_WINDOW(win)); + colormap = gdk_screen_get_rgba_colormap(screen); + + if (colormap != NULL && gdk_screen_is_composited(screen)) + { + gtk_widget_set_colormap(win, colormap); + windata->enable_transparency = TRUE; + } + + gtk_widget_add_events(win, GDK_BUTTON_RELEASE_MASK); gtk_widget_realize(win); g_object_set_data_full(G_OBJECT(win), "windata", windata,