/** * main: **/ int main (int argc, char *argv[]) { Atom edid_atom; Display *display; GError *error = NULL; GnomeRROutput **outputs; GnomeRRScreen *screen; gsize len = 0; guint8 *result = NULL; guint i; gtk_init (&argc, &argv); screen = gnome_rr_screen_new (gdk_screen_get_default (), &error); if (screen == NULL) { g_warning ("failed to get screen: %s", error->message); g_error_free (error); goto out; } display = GDK_SCREEN_XDISPLAY (gdk_screen_get_default ()); outputs = gnome_rr_screen_list_outputs (screen); for (i = 0; outputs[i] != NULL; i++) { g_print ("[%s]\n", gnome_rr_output_get_name (outputs[i])); g_print ("\tconnected: %i\n", gnome_rr_output_is_connected (outputs[i])); g_print ("\tbuilt-in: %i\n", gnome_rr_output_is_builtin_display (outputs[i])); g_print ("\tprimary: %i\n", gnome_rr_output_get_is_primary (outputs[i])); g_print ("\tid: %i\n", gnome_rr_output_get_id (outputs[i])); /* get EDID (first try) */ edid_atom = XInternAtom (display, "EDID", FALSE); result = get_property (display, gnome_rr_output_get_id (outputs[i]), edid_atom, &len); if (result != NULL) { g_print ("\tedid: %" G_GSIZE_FORMAT " bytes [%i:%i:%i:%i]\n", len, result[0], result[1], result[2], result[3]); g_free (result); } /* get EDID (second try) */ edid_atom = XInternAtom (display, "EDID_DATA", FALSE); result = get_property (display, gnome_rr_output_get_id (outputs[i]), edid_atom, &len); if (result != NULL) { g_print ("\tedid2: %" G_GSIZE_FORMAT " bytes [%i:%i:%i:%i]\n", len, result[0], result[1], result[2], result[3]); g_free (result); } } out: g_object_unref (screen); return 0; }
GnomeRRScreen * gnome_settings_session_get_screen (GError **error) { static GnomeRRScreen *screen = NULL; if (screen != NULL) return g_object_ref (screen); screen = gnome_rr_screen_new (gdk_screen_get_default (), error); if (screen != NULL) g_object_add_weak_pointer (G_OBJECT (screen), (gpointer *) &screen); return screen; }