GNOME Bugzilla – Bug 748833
Define GdkRectangle structure just for introspection parsing
Last modified: 2015-05-08 10:48:53 UTC
Following https://bugzilla.gnome.org/show_bug.cgi?id=723394 the property "pointing-to" of GtkPopover became unsettable through Gjs with the following error : Gjs-WARNING **: JS ERROR: TypeError: Object is of type cairo.RectangleInt - cannot convert to GdkRectangle This is because this change made a different between what is returned from introspection data (Cairo.RectangleInt) and when the GObject property gtype is (GdkRectangle). I'm proposing to simply the current situation by removing this automatic conversion from gobject-introspection, and introducing a ifdef at introspection time in Gdk which will define the GdkRectangle structure to help the parser.
Created attachment 302797 [details] [review] gdk: define GdkRectangle structure for introspection scanning
The gobject-introspection bug : https://bugzilla.gnome.org/show_bug.cgi?id=748832
Review of attachment 302797 [details] [review]: This is a very annoying gobject-introspection bug, but it's also our (as in GTK developers) fault, because should have dropped GdkRectangle with GTK+ 3.0 instead of playing games with the type system. ::: gdk/gdktypes.h @@ +76,3 @@ * #cairo_rectangle_int_t. */ +#if defined(GDK_GIR_SCANNING) This symbol is not necessary: g-ir-scanner defines __GI_SCANNER__ while doing the parser pass. You can replace it with: #ifdef __GI_SCANNER__ struct _GdkRectangle { ... }; typedef struct _GdkRectangle GdkRectangle; #else typdef cairo_rectangle_int_it GdkRectangle; #endif @@ +77,3 @@ */ +#if defined(GDK_GIR_SCANNING) +struct _GdkRectangle { The coding style should probably match GDK's; also, it would be good to leave a comment inside explaining why this definition is necessary, otherwise somebody will go over it in a year and decide to delete it.
Created attachment 302820 [details] [review] gdk: define GdkRectangle structure for introspection scanning
Created attachment 302821 [details] [review] gdk: define GdkRectangle structure for introspection scanning Improved comment.
Created attachment 302822 [details] [review] gdk: define GdkRectangle structure for introspection scanning Fix introspection warning on #if defined()
Review of attachment 302822 [details] [review]: ok
Comment on attachment 302822 [details] [review] gdk: define GdkRectangle structure for introspection scanning Pushed to master.
Thanks!