/* * Display screen configuration as seen by GDK. * * Compile with : * cc test_display.c -o test_display `pkg-config --cflags --libs gtk+-2.0` * */ #include #include int main (int argc, char **argv) { gint i, nscreens; GdkDisplay *gdisplay; GdkScreen *gscreen; gtk_init (&argc, &argv); gdisplay = gdk_display_get_default (); nscreens = gdk_display_get_n_screens(gdisplay); g_print ("Current display has %i screen(s) :\n", nscreens); for (i = 0; i < nscreens; i++) { GdkRectangle rect; gint j, nmonitors; gscreen = gdk_display_get_screen(gdisplay, i); nmonitors = gdk_screen_get_n_monitors (gscreen); g_print (" - The screen #%i has %i monitor(s) attached:\n", i, nmonitors); for (j = 0; j < nmonitors; j++) { gdk_screen_get_monitor_geometry (gscreen, j, &rect); g_print (" * Screen #%i, monitor #%i, position (%i, %i), size (%i, %i)\n", i, j, rect.x, rect.y, rect.width, rect.height); } } return 0; }