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

void print_monitor(GdkScreen *screen,int n)
{
  GdkRectangle rect;
  gchar *name = gdk_screen_get_monitor_plug_name (screen, n);
  gdk_screen_get_monitor_geometry (screen, n, &rect);

  printf("monitor %d, name: %s, %dx%d+%d+%d\n",
	 n,name,
	 rect.width,rect.height,
	 rect.x,rect.y);

  if(name)
    g_free(name);
}

int main (int argc,char** arv)
{
  int i;
  gtk_init(&argc,&arv);
  GdkScreen *screen = gdk_screen_get_default ();
  
  for(i = 0; i < gdk_screen_get_n_monitors (screen); i++)
    {
      print_monitor(screen,i);
    }

  printf("primary: ");
  print_monitor(screen,gdk_screen_get_primary_monitor(screen));

  return 0;
}
