diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-02 12:59:17 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-02 12:59:17 +0200 |
commit | 7e1e0cc13e0043508180ef01494d14204b9f3c9e (patch) | |
tree | 9da12d9b321b0f1a0481eb52bf87bb9463403c49 /src | |
parent | m + document (diff) | |
download | blueshift-7e1e0cc13e0043508180ef01494d14204b9f3c9e.tar.gz blueshift-7e1e0cc13e0043508180ef01494d14204b9f3c9e.tar.bz2 blueshift-7e1e0cc13e0043508180ef01494d14204b9f3c9e.tar.xz |
m + document
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/blueshift_iccprofile.c | 3 | ||||
-rw-r--r-- | src/blueshift_idcrtc.c | 26 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/blueshift_iccprofile.c b/src/blueshift_iccprofile.c index 6c1833c..7d97b9f 100644 --- a/src/blueshift_iccprofile.c +++ b/src/blueshift_iccprofile.c @@ -208,7 +208,7 @@ int main(int argc, char** argv) /* Get root window property value */ monitor_ok: - /* Acquire the property's value */ + /* Acquire the property's value, partially. */ prop_cookie = xcb_get_property(connection, 0, screen->root, *atoms, XCB_GET_PROPERTY_TYPE_ANY, 0, 0); prop_reply = xcb_get_property_reply(connection, prop_cookie, &error); @@ -227,6 +227,7 @@ int main(int argc, char** argv) /* Get the length of the property's value */ len = prop_reply->bytes_after; + /* Acquire the property's value, fully. */ prop_cookie = xcb_get_property(connection, 0, screen->root, *atoms, XCB_GET_PROPERTY_TYPE_ANY, 0, len); prop_reply = xcb_get_property_reply(connection, prop_cookie, &error); diff --git a/src/blueshift_idcrtc.c b/src/blueshift_idcrtc.c index 57064b6..71206f2 100644 --- a/src/blueshift_idcrtc.c +++ b/src/blueshift_idcrtc.c @@ -206,9 +206,11 @@ int main(int argc, char** argv) as it is not NUL-terminated. */ printf(" Name: %.*s\n", name_len, name); + /* Check connection status */ switch (out_reply->connection) { case XCB_RANDR_CONNECTION_CONNECTED: + /* IF connectioned, do stuff! */ { xcb_randr_list_output_properties_cookie_t prop_cookie; xcb_randr_list_output_properties_reply_t* prop_reply; @@ -216,21 +218,36 @@ int main(int argc, char** argv) xcb_atom_t* atoms_end; int crtc_i; + /* Print that the connector is used. */ printf(" Connection: connected\n"); + /* And print what dimensions RandR thinks the monitor has, + physically in millimeters, however common that it is + extremely wrong as it does not read it from the extended + display identication data, but tries to calculate it. */ printf(" Size: %i %i\n", out_reply->mm_width, out_reply->mm_height); + /* Iterate over all CRTC:s, */ for (crtc_i = 0; crtc_i < res_reply->num_crtcs; crtc_i++) + /* and look for a CRTC with the same ID, */ if (crtcs[crtc_i] == out_reply->crtc) - printf(" CRTC: %i\n", crtc_i); + { + /* and print that CRTC:s index. */ + printf(" CRTC: %i\n", crtc_i); + break; + } + /* Acquire a list of all properties of the output. */ prop_cookie = xcb_randr_list_output_properties(connection, outputs[output_i]); prop_reply = xcb_randr_list_output_properties_reply(connection, prop_cookie, &error); if (error) { + /* On error print an error message, */ fprintf(stderr, "RandR output property query returned %i\n", error->error_code); + /* and free that output and screen information resources, */ free(out_reply); free(res_reply); + /* and then close the connection to the display. */ xcb_disconnect(connection); return 1; } @@ -238,9 +255,12 @@ int main(int argc, char** argv) /* Get output atoms */ + /* Extract the properties for the data structure that holds them, */ atoms = xcb_randr_list_output_properties_atoms(prop_reply); + /* and get the last one so that we can iterate over them nicely. */ atoms_end = atoms + xcb_randr_list_output_properties_atoms_length(prop_reply); + /* For each property */ for (; atoms != atoms_end; atoms++) { xcb_get_atom_name_cookie_t atom_name_cookie; @@ -312,19 +332,23 @@ int main(int argc, char** argv) free(atom_reply); } + /* Free the name of the atom. */ free(atom_name_reply); } + /* Free the list of properties. */ free(prop_reply); } break; case XCB_RANDR_CONNECTION_DISCONNECTED: + /* If disconnected, print that and continue to next output. */ printf(" Connection: disconnected\n"); break; case XCB_RANDR_CONNECTION_UNKNOWN: default: + /* If the connection status is unkown, print that and continue to next output. */ printf(" Connection: unknown\n"); break; } |