Prints atoms, cardinals, integers, and windows as formatted values instead of lists of bytes.
Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> --- prtype.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/prtype.c b/prtype.c index 04f36cf..182e809 100644 --- a/prtype.c +++ b/prtype.c @@ -1037,8 +1037,48 @@ int PrintPropertyValues(const unsigned char *buf, uint32_t type /* atom */, uint8_t unit, uint32_t num, const char *name) { - if (type == 31 /* string */) + short fieldType = 0; + + switch (type) { + case 4: /* XA_ATOM */ + fieldType = ATOM; + break; + case 6: /* XA_CARDINAL */ + switch (unit) { + case 4: fieldType = CARD32; break; + case 2: fieldType = CARD16; break; + case 1: fieldType = CARD8; break; + default: + goto rawbytes; + } + break; + case 19: /* XA_INTEGER */ + switch (unit) { + case 4: fieldType = INT32; break; + case 2: fieldType = INT16; break; + case 1: fieldType = INT8; break; + default: + goto rawbytes; + } + break; + case 31: /* XA_STRING */ return PrintString8(buf, num * unit, name); + case 33: /* XA_WINDOW */ + fieldType = WINDOW; + break; + default: + /* Fall through to check for known non-builtin types below */ + break; + } + + if (fieldType != 0) { + if (num == 1) { + PrintField(buf, 0, unit, fieldType, name); + return unit; + } + else + return PrintList(buf, num, fieldType, name); + } else { const char *typename = FindAtomName(type); @@ -1047,11 +1087,12 @@ PrintPropertyValues(const unsigned char *buf, uint32_t type /* atom */, if (IsUTF8locale) return PrintString8(buf, num * unit, name); else - return PrintBytes(buf, num * unit, name); + goto rawbytes; } } } + rawbytes: /* When all else fails, print raw bytes */ return PrintBytes(buf, num * unit, name); } -- 1.7.9.2 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel