2 * Copyright (C) 2001-2002 Bart Massey and Jamey Sharp.
3 * All Rights Reserved. See the file COPYING in this directory
4 * for licensing information.
8 #include "reply_formats.h"
10 #define WINFMT "0x%08x"
12 int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *reply)
16 fprintf(stderr, "Failed to get attributes for window " WINFMT ".\n",
17 (unsigned int) wid.xid);
21 printf("Window " WINFMT " has attributes:\n"
22 " backingStore = %d\n"
27 " backingBitPlanes = 0x%08x\n"
28 " backingPixel = %d\n"
30 " mapInstalled = %d\n"
33 " colormap = 0x%08x\n"
34 " allEventMasks = 0x%08x\n"
35 " yourEventMask = 0x%08x\n"
36 " doNotPropagateMask = 0x%08x\n",
37 (unsigned int) wid.xid,
39 (unsigned int) reply->visual.id,
43 reply->backing_planes,
46 reply->map_is_installed,
48 reply->override_redirect,
49 (unsigned int) reply->colormap.xid,
50 (unsigned int) reply->all_event_masks,
51 (unsigned int) reply->your_event_mask,
52 reply->do_not_propagate_mask);
58 int formatGetGeometryReply(XCBWINDOW wid, XCBGetGeometryRep *reply)
62 fprintf(stderr, "Failed to get geometry for window " WINFMT ".\n",
63 (unsigned int) wid.xid);
67 printf("Geometry for window " WINFMT ": %dx%d%+d%+d\n",
68 (unsigned int) wid.xid,
78 int formatQueryTreeReply(XCBWINDOW wid, XCBQueryTreeRep *reply)
84 fprintf(stderr, "Failed to query tree for window " WINFMT ".\n",
85 (unsigned int) wid.xid);
89 printf("Window " WINFMT " has parent " WINFMT ", root " WINFMT ", and %d children%c\n",
90 (unsigned int) wid.xid,
91 (unsigned int) reply->parent.xid,
92 (unsigned int) reply->root.xid,
93 (unsigned int) reply->children_len,
94 reply->children_len ? ':' : '.');
96 for(i = 0; i < reply->children_len; ++i)
97 printf(" window " WINFMT "\n",
98 (unsigned int) XCBQueryTreeChildren(reply)[i].xid);
104 static const char *labelError[] = {
125 static const char *labelRequest[] = {
128 "ChangeWindowAttributes",
129 "GetWindowAttributes",
156 "ChangeActivePointerGrab",
206 "CopyColormapAndFree",
209 "ListInstalledColormaps",
226 "ChangeKeyboardMapping",
227 "GetKeyboardMapping",
228 "ChangeKeyboardControl",
229 "GetKeyboardControl",
231 "ChangePointerControl",
244 "SetModifierMapping",
245 "GetModifierMapping",
256 static const char *labelEvent[] = {
294 static const char *labelSendEvent[] = {
299 int formatEvent(XCBGenericEvent *e)
306 fprintf(stderr, "Error reading event from server.\n");
310 sendEvent = (e->response_type & 0x80) ? 1 : 0;
311 e->response_type &= ~0x80;
312 seqnum = *((CARD16 *) e + 1);
314 switch(e->response_type)
317 printf("Error %s on seqnum %d (%s).\n",
318 labelError[*((BYTE *) e + 1)],
320 labelRequest[*((CARD8 *) e + 10)]);
323 printf("Event %s following seqnum %d%s.\n",
324 labelEvent[e->response_type],
326 labelSendEvent[sendEvent]);
328 case XCBKeymapNotify:
329 printf("Event %s%s.\n",
330 labelEvent[e->response_type],
331 labelSendEvent[sendEvent]);