GNOME Bugzilla – Bug 688040
emit functions for (allow-none) self arguments
Last modified: 2018-02-08 12:19:37 UTC
I'd like to use gdk_window_add_filter through pygobject, which seems currently inaccessible but was available through pygtk: http://pygtk.org/docs/pygtk/class-gdkwindow.html#method-gdkwindow--add-filter The function currently has "(skip)" annotation and I requested to remove it: https://bugzilla.gnome.org/show_bug.cgi?id=687898 However, even it is removed, a couple of obstacles remain: 1. there seems no easy way to pass NULL as the first (self) argument I tried: >>> Gdk.Window.add_filter(None, filter, None) #-> error >>> Gdk.Window.add_filter.__info__.invoke(None, filter, None) #-> error >>> rootwin = Gdk.get_default_root_window() >>> bound = rootwin.add_filter.__get__(None, None.__class__) #-> still unbound 2. the callback cannot receive GdkXEvent argument (which is converted to NULL)
As discussed in bug 687898, I'm reassinging this to gobject-introspection. If we have a method whose self argument is (allow-none), the GI scanner should emit this as a function instead (or in addition, for backwards compatibility).
Created attachment 247300 [details] [review] giscanner: don't treat functions with nullable first argument as method There are a few functions whose first argument is marked as (allow-none) (e.g. gdk_window_add_filter). g-ir-scanner currently recognize them as a method instead of function. If a user really wants to pass NULL, language bindings need to call them as a method of NULL instance. This is not so useful and even not possible with some language bindings. This patch makes g-ir-scanner emit "function" instead of "method" in that case.
This has some overlap with bug 688242. Now that there are annotations in gir files for the instance arguments, this could be moved in the direction of getting the following to work: Gdk.Window.add_filter(None, filter, None) We need to build the instance arg info into typelibs and GI API, then fix up language bindings to also use this info.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/76.