GNOME Bugzilla – Bug 103616
"data" argument to bitmap_create_from_data should have type const-guchar*
Last modified: 2007-05-15 09:37:15 UTC
The "data" argument of bitmap_create_from_data() (corresponding to gdk_bitmap_create_from_data()) is not a C string, but a "width"x"height" array of bits. This array may contain NUL characters, for example. The type "const-gchar*" is therefore inappropriate, since the generated Python raises an exception if string arguments with type "gchar*" or "const-gchar*" have embedded NULs. I think the right type is "const-guchar*", which behaves like "const-gchar*" but allows embedded NULs. Same goes for pixmap_create_from_data(). Note that the GDK functions take "const char *" arguments, which is presumably why "const-gchar*" was chosen in the first place; but unlike most "const char *"s, these are not C strings. I'd like this bug to be fixed some way or other so that I can create custom cursors within PyGTK. Custom cursors = bitmaps = bitmap_create_from_data(). Eddie Index: gtk/gdk.defs =================================================================== RCS file: /cvs/gnome/gnome-python/pygtk/gtk/gdk.defs,v retrieving revision 1.44 diff -u -r1.44 gdk.defs --- gtk/gdk.defs 28 Dec 2002 14:11:23 -0000 1.44 +++ gtk/gdk.defs 16 Jan 2003 00:27:09 -0000 @@ -1653,7 +1653,7 @@ (return-type "GdkBitmap*") (parameters '("GdkWindow*" "window") - '("const-gchar*" "data") + '("const-guchar*" "data") '("gint" "width") '("gint" "height") ) @@ -1664,7 +1664,7 @@ (return-type "GdkPixmap*") (parameters '("GdkWindow*" "window") - '("const-gchar*" "data") + '("const-guchar*" "data") '("gint" "width") '("gint" "height") '("gint" "depth")
Thanks. Fixed in CVS.
Note this bug was introduced again for pygtk-2.8.[12] as reported again in bug number 318874 Unfortunately ubuntu breezy was released with pygtk-2.8.1