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 551184 - Need gdk/gdkkeysyms.h bindings
Need gdk/gdkkeysyms.h bindings
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
0.3.x
Other Linux
: Normal normal
: 1.0
Assigned To: Vala maintainers
Vala maintainers
: 538575 553571 571298 (view as bug list)
Depends on:
Blocks: 577865
 
 
Reported: 2008-09-07 01:23 UTC by Michael Terry
Modified: 2011-09-22 23:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Autogenerated gdkkeysyms (194.58 KB, text/plain)
2008-09-25 07:52 UTC, Andrea Del Signore
  Details
Sed script (255 bytes, text/plain)
2008-09-25 07:54 UTC, Andrea Del Signore
  Details
Add GDK keysyms bindings (69.85 KB, patch)
2010-09-02 20:07 UTC, Evan Nemerson
none Details | Review

Description Michael Terry 2008-09-07 01:23:27 UTC
gdk-2.0.vapi should include the enumeration in gdk/gdkkeysyms.h (assigning a symbol to each keyval number).
Comment 1 Jared Moore 2008-09-07 13:20:47 UTC
*** Bug 538575 has been marked as a duplicate of this bug. ***
Comment 2 Jared Moore 2008-09-25 07:04:15 UTC
*** Bug 553571 has been marked as a duplicate of this bug. ***
Comment 3 Andrea Del Signore 2008-09-25 07:52:13 UTC
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.
Comment 4 Andrea Del Signore 2008-09-25 07:54:12 UTC
Created attachment 119354 [details]
Sed script

this is the hack :)
Comment 5 Andrea Del Signore 2008-12-29 13:37:13 UTC
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.

Comment 6 Michael 'Mickey' Lauer 2009-10-08 12:49:26 UTC
*** Bug 571298 has been marked as a duplicate of this bug. ***
Comment 7 Evan Nemerson 2010-09-02 20:07:40 UTC
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.
Comment 8 Daniel Hams 2010-10-03 04:51:58 UTC
(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....
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2010-12-21 12:31:41 UTC
A workaround suggested on #vala is to use Gdk.keyval_from_name ("Return"). It is of course less efficient that having the constant.
Comment 10 Varga Dániel 2011-01-28 11:21:53 UTC
Gdk.keyval_from_name ("Return") workaround not only less efficient, you can't use in in switch statement, so it is also inconvenient.
Comment 11 Jacques-Pascal Deplaix 2011-09-06 19:21:06 UTC
Why this bug isn't fixed yet ?
The patch has been available for over a year...

What's wrong ?
Comment 12 Evan Nemerson 2011-09-22 23:09:51 UTC
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.