[gtk+] API: Rename gdk_set_source_pixmap() to gdk_set_source_window()



commit 6607f2b794c6ca0555ea7cf8c597103c2115066e
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 27 12:52:59 2010 +0200

    API: Rename gdk_set_source_pixmap() to gdk_set_source_window()
    
    That's what it's used for now.

 docs/reference/gdk/gdk3-sections.txt |    2 +-
 gdk/gdk.symbols                      |    2 +-
 gdk/gdkcairo.c                       |   30 ++++++++++++++++++------------
 gdk/gdkcairo.h                       |    8 ++++----
 gtk/gtkmenu.c                        |    3 +--
 gtk/gtktoolitemgroup.c               |    2 +-
 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 fa89fae..46d94fc 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 9897904..146ec05 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 c5a55c5..7a7fc83 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 c2a71e8..99afc06 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 9b021e3..6cbbc2a 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 86cb7c3..b099ebe 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 c503568..942e842 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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]