#include <gtk/gtk.h>


static void
size_changed_cb (GdkScreen *screen, gpointer user_data)
{
	g_print ("screen size changed: width %d, height %d\n",
		 gdk_screen_get_width (screen),
		 gdk_screen_get_height (screen));
}

static void
monitors_changed_cb (GdkScreen *screen, gpointer user_data)
{
	GdkRectangle m;
	gint i;

	g_print ("monitors changed: %d monitors\n",
		 gdk_screen_get_n_monitors (screen));

	for (i = 0; i < gdk_screen_get_n_monitors (screen); i++) {
		gdk_screen_get_monitor_geometry (screen, i, &m);
		g_print ("%d: x %d, y %d, width %d, height %d\n",
			 m.x, m.y, m.width, m.height); 
	}	
}

int main (int argc, char *argv[])
{
	GdkScreen *screen;

	gtk_init (&argc, &argv);

	screen = gdk_screen_get_default ();

	g_signal_connect (screen, "size-changed", 
			  G_CALLBACK (size_changed_cb), NULL);
	g_signal_connect (screen, "monitors-changed", 
			  G_CALLBACK (monitors_changed_cb), NULL);

	gtk_main ();

	return 0;
}

