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

static gboolean button_press_callback( GtkWidget      *widget, 
                                       GdkEventButton *event,
                                       gpointer        data )
{
    printf("press,   button %d, mask 0x%04x\n", event->button, event->state);
}

static gboolean button_release_callback( GtkWidget      *widget, 
                                         GdkEventButton *event,
                                         gpointer        data )
{
    printf("release, button %d, mask 0x%04x\n", event->button, event->state);
}

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    GtkWidget *button;
    
    gtk_init (&argc, &argv);
    
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    button = gtk_button_new_with_label ("Hello World");
    
    g_signal_connect (button, "button_press_event",
                      G_CALLBACK (button_press_callback), NULL);

    g_signal_connect (button, "button_release_event",
                      G_CALLBACK (button_release_callback), NULL);

    gtk_container_add (GTK_CONTAINER (window), button);
    gtk_widget_show_all (window);
    gtk_main ();
    
    return 0;
}
