[PATCH xrandr 3/3] Special-case printing of the GUID property
Aaron Plattner
aplattner at nvidia.com
Mon Jan 6 12:35:54 PST 2014
Rather than printing GUIDs as 16 signed decimal integers, print them in
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} format.
Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
---
xrandr.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/xrandr.c b/xrandr.c
index 3950e86c8505..a4368fb0cf49 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++)
{
--
1.8.5.2
More information about the xorg-devel
mailing list