-G_MODULE_EXPORT gboolean
-preview_window_expose_cb(
- GtkWidget *widget,
- GdkEventExpose *event,
- signal_user_data_t *ud)
-{
- GdkRegion *region;
- GtkWidget *child;
- cairo_t *cr;
-
- //g_debug("preview_window_expose_cb()");
- /* get our child (in this case, the draw area) */
- child = GHB_WIDGET(ud->builder, "preview_image");
- /* create a cairo context to draw to the window */
- cr = gdk_cairo_create (widget->window);
- /* the source data is the (composited) event box */
- gdk_cairo_set_source_pixmap (cr, child->window,
- child->allocation.x,
- child->allocation.y);
- /* draw no more than our expose event intersects our child */
- region = gdk_region_rectangle (&child->allocation);
- gdk_region_intersect (region, event->region);
- gdk_cairo_region (cr, region);
- cairo_clip (cr);
- /* composite, with a 100% opacity */
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_paint_with_alpha (cr, 1);
-
- cairo_reset_clip(cr);
- /* get our child (in this case, the event box) */
- child = GHB_WIDGET(ud->builder, "preview_event_box");
- /* create a cairo context to draw to the window */
- cr = gdk_cairo_create (widget->window);
- /* the source data is the (composited) event box */
- gdk_cairo_set_source_pixmap (cr, child->window,
- child->allocation.x,
- child->allocation.y);
- /* draw no more than our expose event intersects our child */
- region = gdk_region_rectangle (&child->allocation);
- gdk_region_intersect (region, event->region);
- gdk_cairo_region (cr, region);
- cairo_clip (cr);
- /* composite, with a 85% opacity */
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_paint_with_alpha (cr, .85);
-
- /* we're done */
- cairo_destroy (cr);
- return FALSE;
-}
-