After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 526965 - gdk_cairo_set_source_pixmap API misleadingly using GdkPixmap*?
gdk_cairo_set_source_pixmap API misleadingly using GdkPixmap*?
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: X11
2.12.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-04-08 15:34 UTC by Guillaume Cottenceau
Modified: 2010-09-27 04:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Guillaume Cottenceau 2008-04-08 15:34:00 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:
Comment 1 Sven Herzberg 2008-09-15 21:42:30 UTC
The real question should be: would such a conversion be compatible with the other backends or is the code of the language bindings invalid?
Comment 2 Guillaume Cottenceau 2008-09-15 21:53:53 UTC
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?
Comment 3 Matthias Clasen 2010-09-27 04:20:53 UTC
gdk_cairo_set_source_pixmap no longer exists in GTK3. There's a gdk_cairo_set_source_window instead