GNOME Bugzilla – Bug 643620
Use basic types for XID in xlib-2.0.gir
Last modified: 2018-01-24 19:19:18 UTC
Currently all XLib types are exposed as records, even those that are just uint32_t. Fixing this manually exposes a lot of GdkX11 and ClutterX11 API to language bindings.
Created attachment 182213 [details] [review] xlib: expose useful types for XIDs XIDs are just guint32 in the end, there no need to treat them as boxed. This way instead they're immediately supported in bindings, making stuff like GdkX11 and ClutterX11 much more useful.
Review of attachment 182213 [details] [review]: This looks good to me, shouldn't break anything afaict.
Part of the bug was already fixed by someone else, except that it used gulong instead guint32. I fixed that.
Sorry, but IMO the patch is broken. 1) XID is really 64b on 64b system, see snippet from X.h: Xdef.h, line 61 #ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID # ifndef _XSERVER64 typedef unsigned long XID; # else typedef CARD32 XID; # endif #endif X.h, line 58 /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ #ifndef _XSERVER64 # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef unsigned long XID; # endif # ifndef _XTYPEDEF_MASK So for non-XServer code (which we are interested in), XID is always unsigned long. This can be proven by running following little program: #include <stdio.h> #include <X11/X.h> int main() { printf("%d\n", sizeof(XID); return 0; } This program prints 8 on my F15 x86_64 box 2) There is some bug in scanner's handling of typedefs, scanner somehow fails to follow more than one level of typedef somowhere. Your patch uses two-level typedef (XID->guint32 and Atom/Colormap/whatever->XID), and it results in following warnings while building gtk+/gdk: /home/pavel/src/gnome/gtk+/gdk/x11/gdkproperty-x11.c:218: Warning: GdkX11: gdk_x11_atom_to_xatom_for_display: return value: Missing (transfer) annotation /home/pavel/src/gnome/gtk+/gdk/x11/gdkproperty-x11.c:461: Warning: GdkX11: gdk_x11_get_xatom_by_name_for_display: return value: Missing (transfer) annotation /home/pavel/src/gnome/gtk+/gdk/x11/gdkproperty-x11.c:307: Warning: GdkX11: gdk_x11_atom_to_xatom: return value: Missing (transfer) annotation /home/pavel/src/gnome/gtk+/gdk/x11/gdkproperty-x11.c:482: Warning: GdkX11: gdk_x11_get_xatom_by_name: return value: Missing (transfer) annotation /home/pavel/src/gnome/gtk+/gdk/x11/gdkmain-x11.c:450: Warning: GdkX11: gdk_x11_get_default_root_xwindow: return value: Missing (transfer) annotation /home/pavel/src/gnome/gtk+/gdk/x11/gdkcursor-x11.c:309: Warning: GdkX11: gdk_x11_cursor_get_xcursor: return value: Missing (transfer) annotation /home/pavel/src/gnome/gtk+/gdk/x11/gdkwindow-x11.c:4747: Warning: GdkX11: gdk_x11_window_get_xid: return value: Missing (transfer) annotation and the methods metnioned in the warnings are really not introspected. Sure, it would be nice to fix scanner's bug, but I believe that this patch should be backed out in the meantime.
Ok, I misread the header file. Patch reverted, sorry for the noise.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]