GNOME Bugzilla – Bug 621318
GDK_NONE not bound in gdk-2.0.vapi
Last modified: 2010-06-16 20:05:39 UTC
GDK_NONE (the null value for GdkAtom) is not bound in gdk-2.0.vapi. I will attach a patch that binds it as a static field of Gdk.Atom. However, my implementation is problematic because GDK_NONE isn't actually a const, but a macro that calls _GDK_MAKE_ATOM(0). That means that testing for equality fails with an error: if (Gdk.NONE == Gdk.NONE) test.vala: In function ‘_vala_main’: test.vala:23: error: lvalue required as unary ‘&’ operand test.vala:23: error: lvalue required as unary ‘&’ operand The problem is that, because Gdk.Atom is bound as a struct, valac is generating an internal test-equality function that accepts the address of the two structs. (I have a separate ticket about this issue.) Taking the address of the macro fails. Note that this works: Gdk.Atom a = Gdk.NONE; if (a == a) Also, for some reason my patch modifies several GDK methods that take Gdk.Atom as parameters from normal to out parameters. I'm not sure what I'm going wrong here that causes this.
Created attachment 163425 [details] [review] Binds GDK_NONE to Gdk.Atom. For some reason, other methods are affected in gdk-2.0.vapi, changing their Atom parameters to "out" parameters.
(In reply to comment #0) > GDK_NONE (the null value for GdkAtom) is not bound in gdk-2.0.vapi. I will > attach a patch that binds it as a static field of Gdk.Atom. > > However, my implementation is problematic because GDK_NONE isn't actually a > const, but a macro that calls _GDK_MAKE_ATOM(0). That means that testing for > equality fails with an error: > > if (Gdk.NONE == Gdk.NONE) > > test.vala: In function ‘_vala_main’: > test.vala:23: error: lvalue required as unary ‘&’ operand > test.vala:23: error: lvalue required as unary ‘&’ operand > > The problem is that, because Gdk.Atom is bound as a struct, valac is generating > an internal test-equality function that accepts the address of the two structs. > (I have a separate ticket about this issue.) Taking the address of the macro > fails. We need to investigate what options we have here, however, I think it still makes sense to already merge this. > Also, for some reason my patch modifies several GDK methods that take Gdk.Atom > as parameters from normal to out parameters. I'm not sure what I'm going wrong > here that causes this. The changes are due to imperfect GIDL handling, however, they actually make sense to me - according to the documentation they really are out parameters.
commit 9120dbc8836e7e80f0a5b5c686f6405cf1889135 Author: Jim Nelson <jim@yorba.org> Date: Wed Jun 16 22:02:41 2010 +0200 gdk-2.0: Add GDK_NONE binding Fixes bug 621318.