/* gcc -o `pkg-config --cflags --libs gtk+-2.0` -o test-mask test-mask.c */
#include <gtk/gtk.h>

static void
on_realize (GtkWidget *widget,
	    gpointer data)
{
        GdkBitmap *mask;

        mask = gdk_pixmap_new (widget->window,
                               widget->allocation.width,
                               widget->allocation.height,
                               1);

        /* make the whole window ignore events */
        gdk_window_input_shape_combine_mask (widget->window, mask, 0, 0);
        g_object_unref (mask);
}

int
main ()
{
	GtkWidget *widget;
	GdkDisplay *display;
	gtk_init (NULL, NULL);

	widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_signal_connect (widget, "realize",
			  G_CALLBACK (on_realize),
			  NULL);
	display = gtk_widget_get_display (widget);

	gtk_window_set_screen (GTK_WINDOW (widget),
			       gdk_display_get_screen (display,
						       gdk_display_get_n_screens (display) - 1));

	gtk_widget_show (widget);

	gtk_main ();

	return 0;
}
