Ticket #26 (closed enhancement: fixed)

Opened 7 months ago

Last modified 2 months ago

gdkkeysyms.h keyboard definitions are not wrapped or found anywhere

Reported by: kaarna Assigned to: okibi
Priority: minor Milestone: RC 1
Component: gtkd - classes Version: TRUNK
Keywords: keycode gdkkeysyms.h Cc:

Description

A long standing "problem" with gtkD has been the lack of a wrapped gdk/gdkkeysyms.h. (AFAIK).

It's a file which contains the keycode definions that you can use together with your int onKeyPress( GdkEventKey?* event, Widget widget) by adding it with addOnKeyPress(&onKeyPress);

Then you could have something like:

int onKeyPress( GdkEventKey* event, Widget widget)
{
if(event !is null)
{
	switch( event.keyval )
	{
		default:
		break;
		case GDK_Escape:
		GtkD.mainQuit();
		break;
case GDK_Left:
break;
case GDK_a:
break;
//etc.
}
}
return true;
}

So. Those GDK_Escape keycodes are not currently defined anywhere in gtkD. Someone posted about this in the forums maybe...

The wrapper doesn't handle #define's. I don't know how to add this stuff to the wrapper or the APIlookups. gtkDgl uses htod.exe to do something, if I remember correctly. Maybe that same method could be used to get the #defines too. Or then adding support for the wrapper to parse .h files and find the #defines and structs too. Those aren't found in the documentation, which is currently used for wrapping...

Anyway. Here's a quick file I did with htod.exe that has all the keycodes from gdkkeysyms.h. It should be attached... Maybe someone can figure out a way to possibly put this in /wrap directory and copy it with the APIlookups file copy method to /gdk/Keysyms.d or /gdk/Keysymbols.d. And add it to subversion then... :)

Attachments

Keysyms.d (121.5 kB) - added by kaarna on 01/23/08 06:47:50.
gdkkeysyms.h wrapped with htod.exe

Change History

01/23/08 06:47:50 changed by kaarna

  • attachment Keysyms.d added.

gdkkeysyms.h wrapped with htod.exe

03/30/08 14:48:26 changed by Mike Wey

  • milestone set to Pre-release 9.

06/28/08 11:00:29 changed by okibi

  • owner changed from JJR to okibi.
  • status changed from new to assigned.
  • type changed from defect to enhancement.
  • milestone changed from Pre-release 9 to RC 1.

the Keysyms file will be included in pre-release 9, which will allow you to utilize the keys. This may be wrapped in RC1.

06/29/08 09:44:08 changed by Mike Wey

it might be good to turn this into a Enum.

then you could use it like this:

if( event.keyval == GdkKeysyms.Escape )

07/01/08 16:46:24 changed by okibi

  • status changed from assigned to closed.
  • resolution set to fixed.

Keysyms is now an enum.