[Xcb-commit] 2 commits - xcb-demo xcb-util

Ian Osgood iano at kemper.freedesktop.org
Sat Apr 29 09:45:11 PDT 2006


 xcb-demo/tests/julia.c     |   17 ++++++++---------
 xcb-demo/tests/lissajoux.c |   17 ++++++++---------
 xcb-util/image/xcb_image.c |    8 +++++++-
 3 files changed, 23 insertions(+), 19 deletions(-)

New commits:
diff-tree 0a0e3e4ad76dc1c15dc3e67322033488aed6b5ac (from f5cb5be258110e7ac18ee958d98e9afc93cffd33)
Author: Ian Osgood <iano at quirkster.com>
Date:   Sat Apr 29 09:41:22 2006 -0700

    Remove Xlib.h and X.h dependencies from julia and lissajoux demos.

diff --git a/xcb-demo/tests/julia.c b/xcb-demo/tests/julia.c
index e5f1870..6e5b9c2 100644
--- a/xcb-demo/tests/julia.c
+++ b/xcb-demo/tests/julia.c
@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <X11/Xlib.h>
 #include <X11/XCB/xcb.h>
 #include <X11/XCB/shm.h>
 #include <X11/XCB/xcb_aux.h>
@@ -86,7 +85,7 @@ draw_julia (Data *datap)
   
   datap->image = XCBImageGet (datap->conn, datap->draw,
 		       0, 0, W_W, W_H,
-		       AllPlanes, datap->format);
+		       XCBAllPlanes, datap->format);
   
   for (i = 0 ; i < datap->image->width ; i++)
     for (j = 0 ; j < datap->image->height ; j++)
@@ -133,13 +132,13 @@ main (int argc, char *argv[])
   win.window = screen->root;
 
   data.gc = XCBGCONTEXTNew (data.conn);
-  mask = GCForeground | GCGraphicsExposures;
+  mask = XCBGCForeground | XCBGCGraphicsExposures;
   valgc[0] = screen->black_pixel;
   valgc[1] = 0; /* no graphics exposures */
   XCBCreateGC (data.conn, data.gc, win, mask, valgc);
 
   bgcolor = XCBGCONTEXTNew (data.conn);
-  mask = GCForeground | GCGraphicsExposures;
+  mask = XCBGCForeground | XCBGCGraphicsExposures;
   valgc[0] = screen->white_pixel;
   valgc[1] = 0; /* no graphics exposures */
   XCBCreateGC (data.conn, bgcolor, win, mask, valgc);
@@ -147,14 +146,14 @@ main (int argc, char *argv[])
   data.draw.window = XCBWINDOWNew (data.conn);
   mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
   valwin[0] = screen->white_pixel;
-  valwin[1] = KeyReleaseMask | ButtonReleaseMask | ExposureMask;
-  valwin[2] = ButtonPressMask;
+  valwin[1] = XCBEventMaskKeyRelease | XCBEventMaskButtonRelease | XCBEventMaskExposure;
+  valwin[2] = XCBEventMaskButtonPress;
   XCBCreateWindow (data.conn, 0,
 		   data.draw.window,
 		   screen->root,
 		   0, 0, W_W, W_H,
 		   10,
-		   InputOutput,
+		   XCBWindowClassInputOutput,
 		   screen->root_visual,
 		   mask, valwin);
   XCBMapWindow (data.conn, data.draw.window);
@@ -167,11 +166,11 @@ main (int argc, char *argv[])
 
   XCBMapWindow (data.conn, data.draw.window);
 
-  data.format = ZPixmap;
+  data.format = XCBImageFormatZPixmap;
 
   data.cmap = XCBCOLORMAPNew (data.conn);
   XCBCreateColormap (data.conn,
-		     AllocNone,
+		     XCBColormapAllocNone,
 		     data.cmap,
 		     data.draw.window,
 		     screen->root_visual);
diff --git a/xcb-demo/tests/lissajoux.c b/xcb-demo/tests/lissajoux.c
index 45b971f..49942ca 100644
--- a/xcb-demo/tests/lissajoux.c
+++ b/xcb-demo/tests/lissajoux.c
@@ -8,7 +8,6 @@
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
-#include <X11/Xlib.h>
 #include <X11/XCB/xcb.h>
 #include <X11/XCB/shm.h>
 #include <X11/XCB/xcb_aux.h>
@@ -53,14 +52,14 @@ draw_lissajoux (Data *datap)
       i = XCBImageSHMGet (datap->conn, datap->draw,
 			  datap->image, shminfo,
 			  0, 0,
-			  AllPlanes);
+			  XCBAllPlanes);
       assert(i);
     }
   else
     {
       datap->image = XCBImageGet (datap->conn, datap->draw,
                                   0, 0, W_W, W_H,
-                                  AllPlanes, datap->format);
+                                  XCBAllPlanes, datap->format);
       assert(datap->image);
     }
   
@@ -221,13 +220,13 @@ main (int argc, char *argv[])
   win.window = screen->root;
 
   data.gc = XCBGCONTEXTNew (data.conn);
-  mask = GCForeground | GCGraphicsExposures;
+  mask = XCBGCForeground | XCBGCGraphicsExposures;
   valgc[0] = screen->black_pixel;
   valgc[1] = 0; /* no graphics exposures */
   XCBCreateGC (data.conn, data.gc, win, mask, valgc);
 
   bgcolor = XCBGCONTEXTNew (data.conn);
-  mask = GCForeground | GCGraphicsExposures;
+  mask = XCBGCForeground | XCBGCGraphicsExposures;
   valgc[0] = screen->white_pixel;
   valgc[1] = 0; /* no graphics exposures */
   XCBCreateGC (data.conn, bgcolor, win, mask, valgc);
@@ -235,14 +234,14 @@ main (int argc, char *argv[])
   data.draw.window = XCBWINDOWNew (data.conn);
   mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
   valwin[0] = screen->white_pixel;
-  valwin[1] = KeyPressMask | ButtonReleaseMask | ExposureMask;
-  valwin[2] = ButtonPressMask;
+  valwin[1] = XCBEventMaskKeyPress | XCBEventMaskButtonRelease | XCBEventMaskExposure;
+  valwin[2] = XCBEventMaskButtonPress;
   XCBCreateWindow (data.conn, 0,
 		   data.draw.window,
 		   screen->root,
 		   0, 0, W_W, W_H,
 		   10,
-		   InputOutput,
+		   XCBWindowClassInputOutput,
 		   screen->root_visual,
 		   mask, valwin);
   XCBMapWindow (data.conn, data.draw.window);
@@ -253,7 +252,7 @@ main (int argc, char *argv[])
 		   W_W, W_H);
   XCBPolyFillRectangle(data.conn, rect, bgcolor, 1, &rect_coord);
 
-  data.format = ZPixmap;
+  data.format = XCBImageFormatZPixmap;
   XCBSync (data.conn, 0); 
 
   if (try_shm)
diff-tree f5cb5be258110e7ac18ee958d98e9afc93cffd33 (from f6ea7f034318ba19ee9f3feb32f5bbfbb608a7dc)
Author: Ian Osgood <iano at quirkster.com>
Date:   Sat Apr 29 09:39:35 2006 -0700

    Add some error checking

diff --git a/xcb-util/image/xcb_image.c b/xcb-util/image/xcb_image.c
index bda4dab..303b036 100644
--- a/xcb-util/image/xcb_image.c
+++ b/xcb-util/image/xcb_image.c
@@ -463,6 +463,7 @@ XCBImageSHMGet (XCBConnection *conn,
 {
   XCBShmGetImageRep *rep;
   XCBShmGetImageCookie cookie;
+  XCBGenericError *err = NULL;
 
   if (!shminfo.shmaddr)
     return 0;
@@ -474,11 +475,16 @@ XCBImageSHMGet (XCBConnection *conn,
 			  image->format,
 			  shminfo.shmseg,
 			  image->data - shminfo.shmaddr);
-  rep = XCBShmGetImageReply(conn, cookie, NULL);
+  rep = XCBShmGetImageReply(conn, cookie, &err);
   /* rep would be useful to get the visual id */
   /* but i don't use it */
   /* So, should we remove it ? */
   
+  if (err) {
+    fprintf(stderr, "ShmGetImageReply error %d\n", (int)err->error_code);
+    free(err);
+  }
+  
   if (!rep)
     return 0;
   else {


More information about the xcb-commit mailing list