diff options
-rw-r--r-- | docs/reference/gdk/gdk3-sections.txt | 2 | ||||
-rw-r--r-- | gdk/gdk.symbols | 2 | ||||
-rw-r--r-- | gdk/gdkcairo.c | 30 | ||||
-rw-r--r-- | gdk/gdkcairo.h | 8 | ||||
-rw-r--r-- | gtk/gtkmenu.c | 3 | ||||
-rw-r--r-- | gtk/gtktoolitemgroup.c | 2 | ||||
-rw-r--r-- | tests/testgtk.c | 2 |
7 files changed, 27 insertions, 22 deletions
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index fa89fae98b..46d94fc8f6 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -643,7 +643,7 @@ gdk_window_create_similar_surface gdk_cairo_create gdk_cairo_set_source_color gdk_cairo_set_source_pixbuf -gdk_cairo_set_source_pixmap +gdk_cairo_set_source_window gdk_cairo_rectangle gdk_cairo_region gdk_cairo_reset_clip diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index 9897904671..146ec0502e 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -290,7 +290,7 @@ gdk_cairo_create gdk_cairo_reset_clip gdk_cairo_set_source_color gdk_cairo_set_source_pixbuf -gdk_cairo_set_source_pixmap +gdk_cairo_set_source_window gdk_cairo_rectangle gdk_cairo_region gdk_cairo_region_create_from_surface diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c index c5a55c5c15..7a7fc839cf 100644 --- a/gdk/gdkcairo.c +++ b/gdk/gdkcairo.c @@ -266,28 +266,34 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr, } /** - * gdk_cairo_set_source_pixmap: + * gdk_cairo_set_source_window: * @cr: a #Cairo context - * @pixmap: a #GdkPixmap - * @pixmap_x: X coordinate of location to place upper left corner of @pixmap - * @pixmap_y: Y coordinate of location to place upper left corner of @pixmap + * @window: a #GdkWindow + * @x: X coordinate of location to place upper left corner of @window + * @y: Y coordinate of location to place upper left corner of @window * - * Sets the given pixmap as the source pattern for the Cairo context. + * Sets the given window as the source pattern for the Cairo context. * The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned - * so that the origin of @pixmap is @pixmap_x, @pixmap_y + * so that the origin of @window is @x, @y. The window contains all its + * subwindows when rendering. + * Note that the contents of @window are undefined outside of the + * visible part of @window, so use this function with care. * * Since: 2.10 **/ void -gdk_cairo_set_source_pixmap (cairo_t *cr, - GdkPixmap *pixmap, - double pixmap_x, - double pixmap_y) +gdk_cairo_set_source_window (cairo_t *cr, + GdkWindow *window, + double x, + double y) { cairo_surface_t *surface; - surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (pixmap)); - cairo_set_source_surface (cr, surface, pixmap_x, pixmap_y); + g_return_if_fail (cr != NULL); + g_return_if_fail (GDK_IS_WINDOW (window)); + + surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (window)); + cairo_set_source_surface (cr, surface, x, y); cairo_surface_destroy (surface); } diff --git a/gdk/gdkcairo.h b/gdk/gdkcairo.h index c2a71e8a92..99afc064f8 100644 --- a/gdk/gdkcairo.h +++ b/gdk/gdkcairo.h @@ -40,10 +40,10 @@ void gdk_cairo_set_source_pixbuf (cairo_t *cr, const GdkPixbuf *pixbuf, double pixbuf_x, double pixbuf_y); -void gdk_cairo_set_source_pixmap (cairo_t *cr, - GdkPixmap *pixmap, - double pixmap_x, - double pixmap_y); +void gdk_cairo_set_source_window (cairo_t *cr, + GdkWindow *window, + double x, + double y); void gdk_cairo_rectangle (cairo_t *cr, const GdkRectangle *rectangle); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 9b021e3957..6cbbc2a933 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -1369,8 +1369,7 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu) height); cr = cairo_create (surface); - /* Let's hope that function never notices we're not passing it a pixmap */ - gdk_cairo_set_source_pixmap (cr, + gdk_cairo_set_source_window (cr, window, 0, 0); cairo_paint (cr); diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c index 86cb7c395c..b099ebe399 100644 --- a/gtk/gtktoolitemgroup.c +++ b/gtk/gtktoolitemgroup.c @@ -2326,7 +2326,7 @@ _gtk_tool_item_group_paint (GtkToolItemGroup *group, gtk_widget_get_allocation (widget, &allocation); - gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (widget), + gdk_cairo_set_source_window (cr, gtk_widget_get_window (widget), allocation.x, allocation.y); diff --git a/tests/testgtk.c b/tests/testgtk.c index c503568a99..942e8421e5 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -397,7 +397,7 @@ window_expose_event (GtkWidget *widget, gtk_widget_get_allocation (child, &allocation); /* the source data is the (composited) event box */ - gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (child), + gdk_cairo_set_source_window (cr, gtk_widget_get_window (child), allocation.x, allocation.y); |