Re: hardware keycode



Yep you are right. 
Stupid error on my part, I needed to allocate keys.

thanks,

PG

On Mon, 2003-08-18 at 15:22, Noah Levitt wrote:
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);

Noah

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;
                    }
                    else
                    {
                            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;
                    }

-- 
Peter Gasper <pgasper designadvantage com>




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