Update for RandR 1.2 name changes.
[free-sw/xcb/demo] / reply_formats.c
index 7920f3f..1644435 100644 (file)
@@ -9,12 +9,12 @@
 
 #define WINFMT "0x%08x"
 
-int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *reply)
+int formatGetWindowAttributesReply(xcb_window_t wid, xcb_get_window_attributes_reply_t *reply)
 {
     if(!reply)
     {
         fprintf(stderr, "Failed to get attributes for window " WINFMT ".\n",
-            (unsigned int) wid.xid);
+            (unsigned int) wid);
         return 0;
     }
 
@@ -24,8 +24,8 @@ int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *rep
            "    class              = %d\n"
            "    bitGravity         = %d\n"
            "    winGravity         = %d\n"
-           "    backingBitPlanes   = 0x%08lx\n"
-           "    backingPixel       = %ld\n"
+           "    backingBitPlanes   = 0x%08x\n"
+           "    backingPixel       = %d\n"
            "    saveUnder          = %d\n"
            "    mapInstalled       = %d\n"
            "    mapState           = %d\n"
@@ -34,9 +34,9 @@ int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *rep
            "    allEventMasks      = 0x%08x\n"
            "    yourEventMask      = 0x%08x\n"
            "    doNotPropagateMask = 0x%08x\n",
-        (unsigned int) wid.xid,
+        (unsigned int) wid,
         reply->backing_store,
-        (unsigned int) reply->visual.id,
+        (unsigned int) reply->visual,
         reply->_class,
         reply->bit_gravity,
         reply->win_gravity,
@@ -46,7 +46,7 @@ int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *rep
         reply->map_is_installed,
         reply->map_state,
         reply->override_redirect,
-        (unsigned int) reply->colormap.xid,
+        (unsigned int) reply->colormap,
         (unsigned int) reply->all_event_masks,
         (unsigned int) reply->your_event_mask,
         reply->do_not_propagate_mask);
@@ -55,17 +55,17 @@ int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *rep
     return 1;
 }
 
-int formatGetGeometryReply(XCBWINDOW wid, XCBGetGeometryRep *reply)
+int formatGetGeometryReply(xcb_window_t wid, xcb_get_geometry_reply_t *reply)
 {
     if(!reply)
     {
         fprintf(stderr, "Failed to get geometry for window " WINFMT ".\n",
-            (unsigned int) wid.xid);
+            (unsigned int) wid);
         return 0;
     }
 
     printf("Geometry for window " WINFMT ": %dx%d%+d%+d\n",
-        (unsigned int) wid.xid,
+        (unsigned int) wid,
         reply->width,
         reply->height,
         reply->x,
@@ -75,27 +75,27 @@ int formatGetGeometryReply(XCBWINDOW wid, XCBGetGeometryRep *reply)
     return 1;
 }
 
-int formatQueryTreeReply(XCBWINDOW wid, XCBQueryTreeRep *reply)
+int formatQueryTreeReply(xcb_window_t wid, xcb_query_tree_reply_t *reply)
 {
     int i;
 
     if(!reply)
     {
         fprintf(stderr, "Failed to query tree for window " WINFMT ".\n",
-            (unsigned int) wid.xid);
+            (unsigned int) wid);
         return 0;
     }
 
     printf("Window " WINFMT " has parent " WINFMT ", root " WINFMT ", and %d children%c\n",
-        (unsigned int) wid.xid,
-        (unsigned int) reply->parent.xid,
-        (unsigned int) reply->root.xid,
+        (unsigned int) wid,
+        (unsigned int) reply->parent,
+        (unsigned int) reply->root,
         (unsigned int) reply->children_len,
         reply->children_len ? ':' : '.');
 
     for(i = 0; i < reply->children_len; ++i)
         printf("    window " WINFMT "\n",
-            (unsigned int) XCBQueryTreeChildren(reply)[i].xid);
+            (unsigned int) xcb_query_tree_children(reply)[i]);
 
     fflush(stdout);
     return 1;
@@ -296,10 +296,10 @@ static const char *labelSendEvent[] = {
     " (from SendEvent)",
 };
 
-int formatEvent(XCBGenericEvent *e)
+int formatEvent(xcb_generic_event_t *e)
 {
-    BYTE sendEvent;
-    CARD16 seqnum;
+    uint8_t sendEvent;
+    uint16_t seqnum;
 
     if(!e)
     {
@@ -309,15 +309,15 @@ int formatEvent(XCBGenericEvent *e)
 
     sendEvent = (e->response_type & 0x80) ? 1 : 0;
     e->response_type &= ~0x80;
-    seqnum = *((CARD16 *) e + 1);
+    seqnum = *((uint16_t *) e + 1);
 
     switch(e->response_type)
     {
     case 0:
         printf("Error %s on seqnum %d (%s).\n",
-            labelError[*((BYTE *) e + 1)],
+            labelError[*((uint8_t *) e + 1)],
             seqnum,
-            labelRequest[*((CARD8 *) e + 10)]);
+            labelRequest[*((uint8_t *) e + 10)]);
         break;
     default:
         printf("Event %s following seqnum %d%s.\n",
@@ -325,7 +325,7 @@ int formatEvent(XCBGenericEvent *e)
             seqnum,
             labelSendEvent[sendEvent]);
         break;
-    case XCBKeymapNotify:
+    case XCB_KEYMAP_NOTIFY:
         printf("Event %s%s.\n",
             labelEvent[e->response_type],
             labelSendEvent[sendEvent]);