diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-15 01:32:49 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-09-06 23:22:21 -0700 |
commit | e2ea9f4c3647e9f77027fb59a9ada7c964c1f62d (patch) | |
tree | 6a03f01466093c6b5925cfa04122e77ff89ae1f4 | |
parent | 93c8c0a8813b1a3971cfe9c2712f4afb68d33a44 (diff) |
Create PrintPropertyValues function for property requests
Currently used for core protocol window properties, but will be
used for extensions that have similar property handling requests
in the future.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | print11.c | 16 | ||||
-rw-r--r-- | proto.h | 3 | ||||
-rw-r--r-- | prtype.c | 18 |
3 files changed, 26 insertions, 11 deletions
@@ -1402,9 +1402,9 @@ GetAtomNameReply(const unsigned char *buf) void ChangeProperty(FD fd, const unsigned char *buf) { - long n; - short unit; - long type; + uint32_t n; + uint8_t unit; + uint32_t type; /* Request ChangeProperty is opcode 18 */ PrintField(buf, 0, 1, REQUEST, REQUESTHEADER); /* ChangeProperty */ @@ -1423,10 +1423,7 @@ ChangeProperty(FD fd, const unsigned char *buf) unit = IByte(&buf[16]) / 8; printfield(buf, 20, 4, CARD32, "length of data"); n = ILong(&buf[20]); - if (type == 31 /* string */ ) - PrintString8(&buf[24], n * unit, "data"); - else - PrintBytes(&buf[24], n * unit, "data"); + PrintPropertyValues(&buf[24], type, unit, n, "data"); } void @@ -1482,10 +1479,7 @@ GetPropertyReply(const unsigned char *buf) PrintField(buf, 12, 4, CARD32, "bytes-after"); printfield(buf, 16, 4, CARD32, "length of value"); n = ILong(&buf[16]); - if (type == 31 /* string */ ) - PrintString8(&buf[32], n * unit, "value"); - else - PrintBytes(&buf[32], n * unit, "value"); + PrintPropertyValues(&buf[32], type, unit, n, "value"); } void @@ -257,6 +257,9 @@ extern void PrintTextList8(const unsigned char *buf, int length, const char *name); extern void PrintTextList16(const unsigned char *buf, int length, const char *name); +extern int PrintPropertyValues(const unsigned char *buf, + uint32_t type /* atom */, uint8_t unit, + uint32_t num, const char *name); /* scope.c */ extern void TestBreakPoints(const unsigned char *buf, long n); @@ -1030,6 +1030,24 @@ PrintTextList16(const unsigned char *buf, int length, const char *name) /* */ /* ************************************************************ */ +/* Several extensions have grown property requests mimicing the + core protocol Window properties, and share this code for printing + lists of property values */ +int +PrintPropertyValues(const unsigned char *buf, uint32_t type /* atom */, + uint8_t unit, uint32_t num, const char *name) +{ + if (type == 31 /* string */) + PrintString8(buf, num * unit, name); + else + PrintBytes(buf, num * unit, name); +} + +/* ************************************************************ */ +/* */ +/* */ +/* ************************************************************ */ + #define MAXline 78 void |