/* * Display screen configuration as seen by GDK. * * Compile with : * cc test_display.c -o test_display `pkg-config --cflags --libs gtk+-3.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; GdkRectangle workarea; 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); gdk_screen_get_monitor_workarea (gscreen, j, &workarea); g_print (" * Screen #%i, monitor #%i, (%i, %i) [%i x %i] workarea (%i, %i) [%i x %i]\n", i, j, rect.x, rect.y, rect.width, rect.height, workarea.x, workarea.y, workarea.width, workarea.height); } } return 0; }