GNOME Bugzilla – Bug 526965
gdk_cairo_set_source_pixmap API misleadingly using GdkPixmap*?
Last modified: 2010-09-27 04:20:53 UTC
Please describe the problem: gdk_cairo_set_source_pixmap's second argument is a GdkPixmap* http://library.gnome.org/devel/gdk/unstable/gdk-Cairo-Interaction.html#gdk-cairo-set-source-pixmap however, binding http://library.gnome.org/devel/gdk/2.11/gdk-Windows.html#composited-window-example to ruby-gnome2 demonstrated that it's used here with a GdkWindow* /* the source data is the (composited) event box */ gdk_cairo_set_source_pixmap (cr, child->window, child->allocation.x, child->allocation.y); which is unfortunately not object-wisely compatible with GdkPixmap*. Actually, it works properly in C, because the current implementation of gdk_cairo_set_source_pixmap uses the second argument as a GdkDrawable*, a common ancestor to GdkWindow and GdkPixmap. Shouldn't the API specify GdkDrawable* instead of GdkPixmap*? Or else, how can the example of composite window code be fixed to properly pass a GdkPixmap* to gdk_cairo_set_source_pixmap? Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Other information:
The real question should be: would such a conversion be compatible with the other backends or is the code of the language bindings invalid?
seems that I failed to make myself clear, let me rephrase. the API is "improperly used" in the mentioned compositing example because child->window is not a GdkPixmap* - BUT there is no error triggered at the C level, because gdk_cairo_set_source_pixmap's implementation uses the parameter as a GdkDrawable* (casts using GDK_DRAWABLE()) which is common ancestor to GdkPixmap* and GdkWindow*. the ruby binding triggers an error message because it is somehow "more strict" than the C example, by explicitly casting the child->window parameter using GDK_PIXMAP(). as "with other backends", I am not sure what you're talking about; what seems to me however is that *current* implementation of gdk_cairo_set_source_pixmap uses a GdkPixmap* pixmap as parameter, but uses this parameter as a GdkDrawable*; *so* either the compositing example is wrong in using a child->window (because it is not a GdkPixmap*), or the API gdk_cairo_set_source_pixmap is wrong and should rather be void gdk_cairo_set_source_pixmap (cairo_t *cr, GdkDrawable *pixmap, double pixmap_x, double pixmap_y) that said, set_source_"pixmap" would be an awkward name for that kind of feature then.. see?
gdk_cairo_set_source_pixmap no longer exists in GTK3. There's a gdk_cairo_set_source_window instead