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 748833 - Define GdkRectangle structure just for introspection parsing
Define GdkRectangle structure just for introspection parsing
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-05-03 11:04 UTC by Lionel Landwerlin
Modified: 2015-05-08 10:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdk: define GdkRectangle structure for introspection scanning (1.39 KB, patch)
2015-05-03 11:05 UTC, Lionel Landwerlin
none Details | Review
gdk: define GdkRectangle structure for introspection scanning (1.23 KB, patch)
2015-05-03 21:22 UTC, Lionel Landwerlin
none Details | Review
gdk: define GdkRectangle structure for introspection scanning (1.23 KB, patch)
2015-05-03 21:27 UTC, Lionel Landwerlin
none Details | Review
gdk: define GdkRectangle structure for introspection scanning (1.21 KB, patch)
2015-05-03 21:35 UTC, Lionel Landwerlin
committed Details | Review

Description Lionel Landwerlin 2015-05-03 11:04:19 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.
Comment 1 Lionel Landwerlin 2015-05-03 11:05:12 UTC
Created attachment 302797 [details] [review]
gdk: define GdkRectangle structure for introspection scanning
Comment 2 Lionel Landwerlin 2015-05-03 11:06:32 UTC
The gobject-introspection bug : https://bugzilla.gnome.org/show_bug.cgi?id=748832
Comment 3 Emmanuele Bassi (:ebassi) 2015-05-03 19:35:53 UTC
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.
Comment 4 Lionel Landwerlin 2015-05-03 21:22:48 UTC
Created attachment 302820 [details] [review]
gdk: define GdkRectangle structure for introspection scanning
Comment 5 Lionel Landwerlin 2015-05-03 21:27:42 UTC
Created attachment 302821 [details] [review]
gdk: define GdkRectangle structure for introspection scanning

Improved comment.
Comment 6 Lionel Landwerlin 2015-05-03 21:35:26 UTC
Created attachment 302822 [details] [review]
gdk: define GdkRectangle structure for introspection scanning

Fix introspection warning on #if defined()
Comment 7 Matthias Clasen 2015-05-08 10:42:03 UTC
Review of attachment 302822 [details] [review]:

ok
Comment 8 Lionel Landwerlin 2015-05-08 10:48:40 UTC
Comment on attachment 302822 [details] [review]
gdk: define GdkRectangle structure for introspection scanning

Pushed to master.
Comment 9 Lionel Landwerlin 2015-05-08 10:48:53 UTC
Thanks!