获取显示器个数,以及每个显示器的分辨率和位置
GdkScreen* sc1 = gdk_screen_get_default(); gint nm = gdk_screen_get_n_monitors (sc1); int i = 0; if(nm == 2) { for (i = 0; i < nm; i++) { GdkRectangle rect; gdk_screen_get_monitor_geometry (sc1, i, &rect); printf("%d x %d y %d w %d h %d\n", i, rect.x, rect.y, rect.width, rect.height); } }