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

static gboolean key_release_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
{
    if (event->type == GDK_KEY_RELEASE) {
        switch (event->key.keyval) {
            case GDK_KEY_Shift_L:
                g_print("left shift released\n");
                break;
            case GDK_KEY_Shift_R:
                g_print("right shift released\n");
                break;
            default:
                g_print("keyval %x released\n", event->key.keyval);
                break;
        }
    }

    return FALSE;
}

void 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_release_cb), window);
    g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

    gtk_widget_show(window);

    gtk_main();
}