GNOME Bugzilla – Bug 551184
Need gdk/gdkkeysyms.h bindings
Last modified: 2011-09-22 23:09:51 UTC
gdk-2.0.vapi should include the enumeration in gdk/gdkkeysyms.h (assigning a symbol to each keyval number).
*** Bug 538575 has been marked as a duplicate of this bug. ***
*** Bug 553571 has been marked as a duplicate of this bug. ***
Created attachment 119353 [details] Autogenerated gdkkeysyms Sorry for the dup, I didn't find this bug before. Btw this is an autogenerated gdkkeysym that I made with a sed script, but shouldn't vapigen generate one for us? And also check the constant names.
Created attachment 119354 [details] Sed script this is the hack :)
It would be nice if this bug get fixed, so today I had a talk with blk about writing a script to autogenerate the gdkkeysyms vapi file and he proposed the following approach: Gdk namespace + two enums. [CCode (cname="uint", cprefix="GDK_" cheader_filename="gdk/gdkkeysyms.h")] public enum Gdk.Keysym { ... KP_Right, KP_Down, ... } [CCode (cname="uint", cprefix="GDK_" cheader_filename="gdk/gdkkeysyms.h")] [Flags] public enum Gdk.KeysymModifier { ... Control_L, Control_R, ... } We need also a way to express some keysyms that can't be automatically converted to a valid vala identifier like GDK_0 ... GDK_1 or 3270_* I and blk agree to have in the vapi NUMBER_0 -> NUMBER_9 and EXTENDED_* for the 3270_* Since today I have some time to fix it / write a script or a vala program whatever... It would be nice if some core vala developer can comment on this.
*** Bug 571298 has been marked as a duplicate of this bug. ***
Created attachment 169387 [details] [review] Add GDK keysyms bindings Anyone have any objection to this? It is the result of appending the output of a quick bash script to gdk-2.0-custom.vala, then extracting the modifiers (did I miss any? take any extra?) by hand.
(In reply to comment #7) > Add GDK keysyms bindings > > Anyone have any objection to this? It is the result of appending the output of > a quick bash script to gdk-2.0-custom.vala, then extracting the modifiers (did > I miss any? take any extra?) by hand. Tried it out - had to modify it to include gdk/gdkkeysyms.h and then all smiles were seen. One question - shouldn't the -custom.vala file define it as uint to match the signature of Gdk.keyval_from_name etc? Any chance of getting this pushed? It's rather necessary not to have to do hard-coded key values as vala switch statements like const values....
A workaround suggested on #vala is to use Gdk.keyval_from_name ("Return"). It is of course less efficient that having the constant.
Gdk.keyval_from_name ("Return") workaround not only less efficient, you can't use in in switch statement, so it is also inconvenient.
Why this bug isn't fixed yet ? The patch has been available for over a year... What's wrong ?
commit 9da6293119d584e4a759ed07bd6c54dea442d939 Author: Evan Nemerson <evan@coeus-group.com> Date: Thu Sep 22 15:25:03 2011 -0700 gdk-3.0: switch to GIR Fixes bugs 551184, 649875.