Re: hardware keycode

It looks to me like gdk_keymap_get_entries_for_keyval is
what you want, and you just have memory management problems.
keys and n_keys are probably not allocated. 

 GdkKeymapKey *keys;
 gint n_keys;
 gdk_keymap_get_entries_for_keyval (NULL, GDK_1, &keys, &n_keys);


On Mon, Aug 18, 2003 at 14:37:45 -0600, Peter Gasper wrote:
I am creating an GdkEvent manually. How do I determine the hardware keycode for a
key in gdk/gdkkeysyms.h so I can fill in the value?

Or is that something which is dependent on the installation/system? If so how? Is
there a way to discover the hardware keycodes at runtime?

I tried using gdk_keymap_get_entries_for_keyval to do this but I got segfaults in the else portion of the 
following code.

                      GdkKeymapKey **keys;
                      gint *n_keys;
                      if( !gdk_keymap_get_entries_for_keyval(NULL, GDK_1, keys, n_keys) )
                              cout << "Keyval translation failed." << endl;
                              cout << *n_keys << endl;
                              cout << "hardware_keycode: " << keys[0]->keycode << endl;
                              cout << "group: " << keys[0]->group << endl;
                              cout << "level: " << keys[0]->level << endl;
                              cout << "done" << endl;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]