Commit 07d26d39 authored by Julien Cristau's avatar Julien Cristau

Add handling of GetAtomName

Just like InternAtom requests, GetAtomName allows us to learn about Atom
values.
parent 6a51824f
......@@ -174,12 +174,14 @@ struct expectedreply {
dt_UNKNOWN_EXTENSION, /* uextension used */
dt_EXTENSION, /* extension used */
dt_ATOM, /* atom used */
dt_CARD32, /* card32 used */
} data_type;
union {
void *data;
struct atom *atom;
const struct extension *extension;
struct unknownextension *uextension;
uint32_t card32;
} data;
unsigned long values[];
};
......@@ -1505,6 +1507,20 @@ bool requestInternAtom(struct connection *c, bool pre, bool bigrequest UNUSED, s
return false;
}
bool requestGetAtomName(struct connection *c, bool pre, bool bigrequest UNUSED, struct expectedreply *reply) {
uint32_t atom;
if( pre )
return false;
if( reply == NULL)
return false;
if( c->clientignore < 8 )
return false;
atom = clientCARD32(4);
reply->data_type = dt_CARD32;
reply->data.card32 = atom;
return false;
}
/* Reactions to some replies */
void replyListFontsWithInfo(struct connection *c, bool *ignore, bool *dontremove, struct expectedreply *dummy UNUSED) {
......@@ -1562,6 +1578,16 @@ void replyInternAtom(struct connection *c, bool *ignore UNUSED, bool *dontremove
internAtom(c, atom, d->data.atom);
}
void replyGetAtomName(struct connection *c, bool *ignore UNUSED, bool *dontremove UNUSED, struct expectedreply *d) {
struct atom *atom;
uint16_t len;
if( d->data_type != dt_CARD32 || d->data.card32 == 0 )
return;
len = serverCARD16(8);
atom = newAtom((const char *)c->serverbuffer+32, len);
internAtom(c, d->data.card32, atom);
}
#define ft_COUNT8 ft_STORE8
#define ft_COUNT16 ft_STORE16
#define ft_COUNT32 ft_STORE32
......
......@@ -167,8 +167,10 @@ extern const struct parameter *setup_parameters;
/* special handlers, for the SPECIAL requests/events */
extern request_func requestQueryExtension;
extern request_func requestInternAtom;
extern request_func requestGetAtomName;
extern reply_func replyListFontsWithInfo;
extern reply_func replyQueryExtension;
extern reply_func replyInternAtom;
extern reply_func replyGetAtomName;
#endif
......@@ -111,7 +111,7 @@ CirculateWindow
GetGeometry RESPONDS
QueryTree RESPONDS
InternAtom RESPONDS SPECIAL
GetAtomName RESPONDS
GetAtomName RESPONDS SPECIAL
ChangeProperty
DeleteProperty
GetProperty RESPONDS /* 20*/
......
......@@ -2460,6 +2460,9 @@ static const struct request *finalize_requests(struct parser *parser, struct nam
} else if( strcmp(rs[i].name, "ListFontsWithInfo") == 0 ) {
/* this should be changed to a general approach */
rs[i].reply_func = replyListFontsWithInfo;
} else if( strcmp(rs[i].name, "GetAtomName") == 0) {
rs[i].request_func = requestGetAtomName;
rs[i].reply_func = replyGetAtomName;
} else {
fprintf(stderr, "No specials available for '%s::%s'!\n",
ns->name, rs[i].name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment