#include <gtk/gtk.h>
#include <gdk/gdk.h>

int
main (int   argc,
      char *argv[])
{
  GdkKeymap    *keymap;
  GdkKeymapKey *keys;
  guint        numb;

  numb = atoi(argv[1]);

  gtk_init (&argc, &argv);

  keymap = gdk_keymap_get_default();
  gint numbers;

  printf("Keyval given = %d\n", numb);

  if (gdk_keymap_get_entries_for_keyval(keymap, numb, &keys, &numbers))
  {

    printf("Nº of keys = %d\n\n", numbers);

    int key;
    for (key = 0; key <= numbers - 1; key++){
      printf("Key %d.keycode = %d\n", key, keys[key].keycode);
      printf("Key %d.group = %d\n", key, keys[key].group);
      printf("Key %d.level = %d\n\n", key, keys[key].level);
    }
  
  }

  return 0;
}
