#include <gtk/gtk.h>

static int x = 0, y = 0;

gboolean show_hide_window (GtkWidget * window)
{
    if (gtk_widget_get_visible (window))
    {
        gtk_window_get_position ((GtkWindow *) window, & x, & y);
        gtk_widget_hide (window);
    }
    else
    {
        gtk_window_move ((GtkWindow *) window, x, y);
        gtk_widget_show (window);
    }

    return TRUE;
}

int main (void)
{
    gtk_init (NULL, NULL);

    GtkWidget * window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size ((GtkWindow *) window, 200, 200);
    gtk_widget_show (window);

    g_timeout_add_seconds (3, (GSourceFunc) show_hide_window, window);

    gtk_main ();

    return 0;
}
