[Xcb] toying XCB

Laurent Boulard l.boulard@wanadoo.fr
Tue, 11 Nov 2003 19:20:09 +0100


This is a multi-part message in MIME format.
--------------050601060502010803020306
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

This afternoon, I decided to waste my free time on today (11 Nov 2003) 
XCB cvs. Everything was played using debian sid. Following is the short 
feedback and correction from cvs I made.

I found the dependencies on Xproto and Xau from FreeDesktop annoying. I 
did not want to modified my current installation (XFree86 4.3 from 
debian experimental project). So, I get the freedesktop cvs for xlibs 
and made autogen.sh then the "./configure --prefix=/usr/X11R6; make" in 
xlibs/Xproto and xlibs/Xau. I did NOT "make install". I copy 
xlibs/Xproto/xproto.pc and xlibs/Xau/xau.pc in /usr/lib/pkgconfig (may 
be /lib/pkgconfig on other distro).

During the ./autogen.sh adventures, I get lot of complains and errors. I 
upgraded to the automake1.8 package. Errors vanished after cleanin up 
old stuff from previous automake. The automake1.4 was too old.

I went to compile xcb/xcb-proto:

./autogen.sh
./configure --prefix=/usr
make
make install

I then go to xcb/xcb

./autogen.sh
./configure --prefix=/usr/X11R6
make
make install
ldconfig # for updating the installed library

Everything went smooth with automake version corrected.

The place of xcb.pc is wrong, I modified it by hand:
mv /usr/X11R6/lib/pkgconfig/xcb.pc /usr/lib/pkgconfig/
rmdir /usr/X11R6/lib/pkgconfig

Then I tried the stuff in xcb-demo.

I got lot of troubles for each demos but were just minors typos in the 
end. I included at the end the small corrections I made (a compile.sh 
help is included per directory). All demos compiled and ran.

rendertest display was garbage using XFree86 4.3 with a radeon 9000. It 
worked nicely with a remote display on MacOS X using last XonX (XFree86 
4.3)for 10.2.8.



--------------050601060502010803020306
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
 name="diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="diff"

diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/hypnomoire/compile.=
sh xcb.my/xcb-demo/hypnomoire/compile.sh
--- xcb/xcb-demo/hypnomoire/compile.sh	1970-01-01 01:00:00.000000000 +010=
0
+++ xcb.my/xcb-demo/hypnomoire/compile.sh	2003-11-11 16:04:16.000000000 +=
0100
@@ -0,0 +1 @@
+gcc -Wall -o hypnomoire hypnomoire.c ../tests/reply_formats.c -I../tests=
/ `pkg-config --libs --cflags xcb` -lm -lpthread
Les fichiers binaires xcb/xcb-demo/hypnomoire/hypnomoire et xcb.my/xcb-de=
mo/hypnomoire/hypnomoire sont diff=E9rents.
diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/hypnomoire/hypnomoi=
re.c xcb.my/xcb-demo/hypnomoire/hypnomoire.c
--- xcb/xcb-demo/hypnomoire/hypnomoire.c	2002-06-05 13:38:29.000000000 +0=
200
+++ xcb.my/xcb-demo/hypnomoire/hypnomoire.c	2003-11-11 16:10:59.000000000=
 +0100
@@ -47,7 +47,7 @@
 	DRAWABLE rootwin;
=20
 	c =3D XCBConnectBasic();
-	root =3D XCBConnSetupSuccessReproots(c->setup).data;
+	root =3D XCBConnSetupSuccessRepRoots(c->setup).data;
=20
 	rootwin.window =3D root->root;
 	white =3D XCBGCONTEXTNew(c);
@@ -110,7 +110,7 @@
 		values[1] =3D ButtonReleaseMask | ExposureMask;
 		values[2] =3D ButtonPressMask;
=20
-		depth =3D SCREENallowed_depths(root).data->depth;
+		depth =3D SCREENAllowedDepths(root).data->depth;
=20
 		XCBCreateWindow(c, depth, windows[idx].w.window, root->root,
 			/* x */ 0, /* y */ 0,
diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/tests/compile.sh xc=
b.my/xcb-demo/tests/compile.sh
--- xcb/xcb-demo/tests/compile.sh	1970-01-01 01:00:00.000000000 +0100
+++ xcb.my/xcb-demo/tests/compile.sh	2003-11-11 16:37:29.000000000 +0100
@@ -0,0 +1,4 @@
+[ -e main ] || gcc -Wall -o main main.c reply_formats.c `pkg-config --li=
bs --cflags xcb` -lm -lpthread
+[ -e rendertest ] || gcc -Wall -o rendertest rendertest.c reply_formats.=
c `pkg-config --libs --cflags xcb` -lm -lpthread
+[ -e dpms ] || gcc -Wall -o dpms dpms.c reply_formats.c `pkg-config --li=
bs --cflags xcb` -lm -lpthread
+
Les fichiers binaires xcb/xcb-demo/tests/dpms et xcb.my/xcb-demo/tests/dp=
ms sont diff=E9rents.
diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/tests/dpms.c xcb.my=
/xcb-demo/tests/dpms.c
--- xcb/xcb-demo/tests/dpms.c	2002-06-05 10:16:17.000000000 +0200
+++ xcb.my/xcb-demo/tests/dpms.c	2003-11-11 16:37:43.000000000 +0100
@@ -5,7 +5,7 @@
  */
=20
 #include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_dpms.h>
+#include <X11/XCB/dpms.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
Les fichiers binaires xcb/xcb-demo/tests/main et xcb.my/xcb-demo/tests/ma=
in sont diff=E9rents.
diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/tests/main.c xcb.my=
/xcb-demo/tests/main.c
--- xcb/xcb-demo/tests/main.c	2003-10-11 10:49:01.000000000 +0200
+++ xcb.my/xcb-demo/tests/main.c	2003-11-11 16:14:34.000000000 +0100
@@ -23,7 +23,6 @@
 #include <stdlib.h>
=20
 #include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_event.h>
 #include "reply_formats.h"
=20
 void try_events(XCBConnection *c);
@@ -59,7 +58,7 @@
 #endif
=20
     c =3D XCBConnectBasic();
-    root =3D XCBConnSetupSuccessReproots(c->setup).data;
+    root =3D XCBConnSetupSuccessRepRoots(c->setup).data;
=20
 #ifdef TEST_THREADS
 # ifdef VERBOSE
@@ -94,7 +93,7 @@
     mask |=3D XCBCWDontPropagate;
     values[5] =3D ButtonPressMask;
=20
-    XCBCreateWindow(c, SCREENallowed_depths(root).data->depth,
+    XCBCreateWindow(c, SCREENAllowedDepths(root).data->depth,
         window, root->root,
         /* x */ 20, /* y */ 200, /* width */ 150, /* height */ 150,
         /* border_width */ 10, /* class */ InputOutput,
Les fichiers binaires xcb/xcb-demo/tests/rendertest et xcb.my/xcb-demo/te=
sts/rendertest sont diff=E9rents.
diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/tests/rendertest.c =
xcb.my/xcb-demo/tests/rendertest.c
--- xcb/xcb-demo/tests/rendertest.c	2002-06-17 09:32:26.000000000 +0200
+++ xcb.my/xcb-demo/tests/rendertest.c	2003-11-11 16:32:39.000000000 +010=
0
@@ -1,12 +1,14 @@
=20
 #include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_render.h>
+#include <X11/XCB/render.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
=20
 /*
  * FUNCTION PROTOTYPES
  */
-int print_version_info(XCBRenderQueryVersionRep *reply);
+void print_version_info(XCBRenderQueryVersionRep *reply);
 int print_formats_info(XCBRenderQueryPictFormatsRep *reply);
 int draw_window(XCBConnection *conn, XCBRenderQueryPictFormatsRep *reply=
);
 PICTFORMAT get_pictformat_from_visual(XCBRenderQueryPictFormatsRep *repl=
y, VISUALID visual);
@@ -15,10 +17,10 @@
 XCBConnection   *c;
 PICTFORMAT pf;
=20
-int print_version_info(XCBRenderQueryVersionRep *reply)
+void print_version_info(XCBRenderQueryVersionRep *reply)
 {
    =20
-    fprintf(stdout, "Render Version: %d.%d\n", reply->major_version,=20
+    fprintf(stdout, "Render Version: %ld.%ld\n", reply->major_version,=20
             reply->minor_version);
 }
=20
@@ -32,8 +34,8 @@
     PICTFORMINFOIter forminfo_iter;
     PICTSCREENIter     screen_iter;
    =20
-    forminfo_iter =3D XCBRenderQueryPictFormatsformats(reply);
-    screen_iter =3D  XCBRenderQueryPictFormatsscreens(reply);
+    forminfo_iter =3D XCBRenderQueryPictFormatsFormats(reply);
+    screen_iter =3D  XCBRenderQueryPictFormatsScreens(reply);
=20
     fprintf(stdout, "Number of PictFormInfo iterations: %d\n", forminfo_=
iter.rem);
=20
@@ -45,7 +47,7 @@
         PICTFORMINFO *forminfo =3D (PICTFORMINFO *)forminfo_iter.data;
=20
         fprintf(stdout, "PICTFORMINFO #%d\n", 1 + num_formats - forminfo=
_iter.rem);
-        fprintf(stdout, "    PICTFORMAT ID:          %d\n", forminfo->id=
=2Exid);
+        fprintf(stdout, "    PICTFORMAT ID:          %ld\n", forminfo->i=
d.xid);
         fprintf(stdout, "    PICTFORMAT Type:        %d\n", forminfo->ty=
pe);
         fprintf(stdout, "    PICTFORMAT Depth:       %d\n", forminfo->de=
pth);
         fprintf(stdout, "        Direct RedShift:    %d\n", forminfo->di=
rect.red_shift);
@@ -67,9 +69,9 @@
         PICTSCREEN *cscreen =3D screen_iter.data;
        =20
         fprintf(stdout, "Screen #%d\n", 1 + num_screens - screen_iter.re=
m);
-        fprintf(stdout, "    Depths for this screen:    %d\n", cscreen->=
num_depths);
-        fprintf(stdout, "    Fallback PICTFORMAT:       %d\n", cscreen->=
fallback.xid);
-        depth_iter =3D PICTSCREENdepths(cscreen);
+        fprintf(stdout, "    Depths for this screen:    %ld\n", cscreen-=
>num_depths);
+        fprintf(stdout, "    Fallback PICTFORMAT:       %ld\n", cscreen-=
>fallback.xid);
+        depth_iter =3D PICTSCREENDepths(cscreen);
=20
         num_depths =3D cscreen->num_depths;
         while(depth_iter.rem)
@@ -80,7 +82,7 @@
             fprintf(stdout, "    Depth #%d\n", 1 + num_depths - depth_it=
er.rem);
             fprintf(stdout, "        Visuals for this depth:    %d\n", c=
depth->num_visuals);
             fprintf(stdout, "        Depth:                     %d\n", c=
depth->depth);
-            visual_iter =3D PICTDEPTHvisuals(cdepth);
+            visual_iter =3D PICTDEPTHVisuals(cdepth);
=20
             num_visuals =3D cdepth->num_visuals;
             while(visual_iter.rem)
@@ -88,8 +90,8 @@
                 PICTVISUAL *cvisual =3D visual_iter.data;
                =20
                 fprintf(stdout, "        Visual #%d\n", 1 + num_visuals =
- visual_iter.rem);
-                fprintf(stdout, "            VISUALID:      %d\n", cvisu=
al->visual.id);
-                fprintf(stdout, "            PICTFORMAT:    %d\n", cvisu=
al->format.xid);
+                fprintf(stdout, "            VISUALID:      %ld\n", cvis=
ual->visual.id);
+                fprintf(stdout, "            PICTFORMAT:    %ld\n", cvis=
ual->format.xid);
                 PICTVISUALNext(&visual_iter);
             }
             PICTDEPTHNext(&depth_iter);
@@ -118,7 +120,7 @@
     POINTFIX        trifans[9];
     int index;
=20
-    root =3D XCBConnSetupSuccessReproots(c->setup).data;
+    root =3D XCBConnSetupSuccessRepRoots(c->setup).data;
     root_drawable.window =3D root->root;
   =20
     /* Setting query so that it will search for an 8 bit alpha surface. =
*/
@@ -413,18 +415,18 @@
     PICTVISUAL    *cvisual;
     PICTFORMAT  return_value;
    =20
-    screen_iter =3D XCBRenderQueryPictFormatsscreens(reply);
+    screen_iter =3D XCBRenderQueryPictFormatsScreens(reply);
=20
     while(screen_iter.rem)
     {
         cscreen =3D screen_iter.data;
        =20
-        depth_iter =3D PICTSCREENdepths(cscreen);
+        depth_iter =3D PICTSCREENDepths(cscreen);
         while(depth_iter.rem)
         {
             cdepth =3D depth_iter.data;
=20
-            visual_iter =3D PICTDEPTHvisuals(cdepth);
+            visual_iter =3D PICTDEPTHVisuals(cdepth);
             while(visual_iter.rem)
             {
                 cvisual =3D visual_iter.data;
@@ -447,7 +449,7 @@
 {
     PICTFORMINFOIter forminfo_iter;
    =20
-    forminfo_iter =3D XCBRenderQueryPictFormatsformats(reply);
+    forminfo_iter =3D XCBRenderQueryPictFormatsFormats(reply);
=20
     while(forminfo_iter.rem)
     {
@@ -510,7 +512,7 @@
     PICTFORMINFO  forminfo_query, *forminfo_result;
    =20
     c =3D XCBConnectBasic();
-    root =3D XCBConnSetupSuccessReproots(c->setup).data;
+    root =3D XCBConnSetupSuccessRepRoots(c->setup).data;
    =20
     version_cookie =3D XCBRenderQueryVersion(c, (CARD32)0, (CARD32)3);
     version_reply =3D XCBRenderQueryVersionReply(c, version_cookie, 0);
@@ -533,10 +535,10 @@
     forminfo_query.direct.alpha_mask =3D 255;
    =20
     forminfo_result =3D get_pictforminfo(formats_reply, &forminfo_query)=
;
-    fprintf(stdout, "\n***** found PICTFORMAT:  %d *****\n",
+    fprintf(stdout, "\n***** found PICTFORMAT:  %ld *****\n",
             forminfo_result->id.xid);
     rootformat =3D get_pictformat_from_visual(formats_reply, root->root_=
visual);
-    fprintf(stdout, "\n***** found root PICTFORMAT:   %d *****\n", rootf=
ormat.xid);
+    fprintf(stdout, "\n***** found root PICTFORMAT:   %ld *****\n", root=
format.xid);
   =20
     //draw_window(c, formats_reply);
    =20
diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/tests/reply_formats=
=2Ec xcb.my/xcb-demo/tests/reply_formats.c
--- xcb/xcb-demo/tests/reply_formats.c	2002-03-21 20:11:31.000000000 +010=
0
+++ xcb.my/xcb-demo/tests/reply_formats.c	2003-11-11 18:21:25.000000000 +=
0100
@@ -95,7 +95,7 @@
=20
     for(i =3D 0; i < reply->children_len; ++i)
         printf("    window " WINFMT "\n",
-            (unsigned int) XCBQueryTreechildren(reply)[i].xid);
+            (unsigned int) XCBQueryTreeChildren(reply)[i].xid);
=20
     fflush(stdout);
     return 1;
diff -Nru --exclude-from=3Dexclude-files xcb/xcb-demo/xapps/compile.sh xc=
b.my/xcb-demo/xapps/compile.sh
--- xcb/xcb-demo/xapps/compile.sh	1970-01-01 01:00:00.000000000 +0100
+++ xcb.my/xcb-demo/xapps/compile.sh	2003-11-11 16:39:36.000000000 +0100
@@ -0,0 +1,2 @@
+[ -e xdpyinfo ] || gcc -Wall -o xdpyinfo xdpyinfo.c `pkg-config --libs -=
-cflags xcb` -lm -lpthread
+
Les fichiers binaires xcb/xcb-demo/xapps/xdpyinfo et xcb.my/xcb-demo/xapp=
s/xdpyinfo sont diff=E9rents.

--------------050601060502010803020306--