summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2014-01-03 05:48:17 -0800
committerAaron Plattner <aplattner@nvidia.com>2014-01-07 10:26:42 -0800
commit7ede207f9064fd88427026e38818819c2c8422bb (patch)
tree79bfb4c21ae14e536e89583d75731a0a6a4e990a
parente7a19c8b5a26c8bfd76a7399a1a15eac01184261 (diff)
Special-case printing of the GUID property
Rather than printing GUIDs as 16 signed decimal integers, print them in {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} format. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--xrandr.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/xrandr.c b/xrandr.c
index ddc6c64..0a182c3 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2426,6 +2426,25 @@ print_edid(int nitems, const unsigned char *prop)
}
static void
+print_guid(const unsigned char *prop)
+{
+ int k;
+
+ printf("{");
+
+ for (k = 0; k < 16; k++)
+ {
+ printf("%02" PRIX8, prop[k]);
+ if (k == 3 || k == 5 || k == 7 || k == 9)
+ {
+ printf("-");
+ }
+ }
+
+ printf("}\n");
+}
+
+static void
print_output_property(const char *atom_name,
int value_format,
Atom value_type,
@@ -2444,6 +2463,12 @@ print_output_property(const char *atom_name,
print_edid (nitems, prop);
return;
}
+ else if (strcmp (atom_name, "GUID") == 0 && value_format == 8 &&
+ value_type == XA_INTEGER && nitems == 16)
+ {
+ print_guid (prop);
+ return;
+ }
for (k = 0; k < nitems; k++)
{