// build as $gcc test.c -o test `pkg-config --cflags --libs gtk+-3.0`

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

static void
frame_clock_callback(GdkFrameClock *clock, gpointer test)
{
    static int num = 0;
    fprintf(stderr, "frame_clock_callback() num = %d\n", num++);
}

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    
    gtk_init (&argc, &argv);
    
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_show  (window);
    
    {
        GtkWidget *mHiddenWidget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_widget_realize(mHiddenWidget);
        
        // Uncomment to get frame clock events
        // gtk_widget_show(mHiddenWidget);
      
        GdkFrameClock *frame_clock = gtk_widget_get_frame_clock(mHiddenWidget);
        g_signal_connect (frame_clock, "update",
                          G_CALLBACK (frame_clock_callback),
                          mHiddenWidget);
        gdk_frame_clock_begin_updating (frame_clock);
    }
    
    gtk_main ();
    
    return 0;
}
