#include <gtk/gtk.h>

static gboolean key_event(GtkWidget *widget, GdkEventKey *event)
{
    if(event->is_modifier)
        return FALSE;

    g_printerr("key: %s, keycode: %d\n", gdk_keyval_name (event->keyval), event->keyval);

    g_printerr("-> hardware_keycode: %u, group: %d, state: %d\n",
                event->hardware_keycode, event->group, event->state);

    return FALSE;
}

int main(int argc, char *argv[])
{
    GtkWidget *window;

    gtk_init(&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    g_signal_connect(window, "key-release-event", G_CALLBACK(key_event), NULL);
    g_signal_connect(G_OBJECT(window), "destroy",  G_CALLBACK(gtk_main_quit), NULL);

    gtk_widget_show (window);
    gtk_main ();

    return 0;
}
