[Xcb-commit] 5 commits - xcb xcb-demo xcb-proto xcb-util

Ian Osgood iano at kemper.freedesktop.org
Wed Mar 15 11:07:29 PST 2006


 xcb-demo/hypnomoire.c      |   18 ++--
 xcb-demo/main.c            |   15 +--
 xcb-demo/rendertest.c      |    2 
 xcb-demo/xcbrandr.c        |    9 --
 xcb-demo/xdpyinfo.c        |    4 
 xcb-proto/src/xcb.xsd      |    5 +
 xcb-proto/src/xproto.xml   |  194 ++++++++++++++++++++++++++++++++++-----------
 xcb-util/icccm/icccm.c     |    8 -
 xcb-util/image/xcb_image.c |   63 +++++++-------
 xcb-util/keysyms/keysyms.c |    2 
 xcb-util/property/prop.c   |    6 -
 xcb-util/wm/manage.c       |    4 
 xcb-util/wm/xcbwm-test.c   |   16 +--
 xcb/src/c-client.xsl       |    6 +
 xcb/src/xcb.h              |    6 +
 xcb/src/xcb_conn.c         |    2 
 16 files changed, 240 insertions(+), 120 deletions(-)

New commits:
diff-tree 0d0a38bb97c5c9bdbe106f1a1027b79a4806eb47 (from df7e48d7bcbd2c978ed714251f885bc6fc3b2e57)
Author: Ian Osgood <iano at quirkster.com>
Date:   Wed Mar 15 10:09:47 2006 -0800

    Remove proto/X11 dependencies from xcb-demo.

diff --git a/xcb-demo/hypnomoire.c b/xcb-demo/hypnomoire.c
index 0b47d83..ffd4a5e 100644
--- a/xcb-demo/hypnomoire.c
+++ b/xcb-demo/hypnomoire.c
@@ -60,7 +60,7 @@ int main()
 	pthread_t thr;
 	int i;
 
-	CARD32 mask = GCForeground | GCGraphicsExposures;
+	CARD32 mask = XCBGCForeground | XCBGCGraphicsExposures;
 	CARD32 values[2];
 	XCBDRAWABLE rootwin;
 	int screen_num;
@@ -130,13 +130,13 @@ void *run(void *param)
 		CARD32 values[3];
 		XCBRECTANGLE rect = { 0, 0, windows[idx].width, windows[idx].height };
 		values[0] = root->white_pixel;
-		values[1] = ButtonReleaseMask | ExposureMask;
-		values[2] = ButtonPressMask;
+		values[1] = XCBEventMaskButtonRelease | XCBEventMaskExposure;
+		values[2] = XCBEventMaskButtonPress;
 
 		XCBCreateWindow(c, depth, windows[idx].w.window, root->root,
 			/* x */ 0, /* y */ 0,
 			windows[idx].width, windows[idx].height,
-			/* border */ 0, InputOutput,
+			/* border */ 0, XCBWindowClassInputOutput,
 			/* visual */ root->root_visual,
 			mask, values);
 
@@ -155,12 +155,12 @@ void *run(void *param)
 	{
 		line[1].x = xo + r * cos(theta);
 		line[1].y = yo + r * sin(theta);
-		XCBPolyLine(c, CoordModeOrigin, windows[idx].p, black,
+		XCBPolyLine(c, XCBCoordModeOrigin, windows[idx].p, black,
 			2, line);
 
 		line[1].x = xo + r * cos(theta + LAG);
 		line[1].y = yo + r * sin(theta + LAG);
-		XCBPolyLine(c, CoordModeOrigin, windows[idx].p, white,
+		XCBPolyLine(c, XCBCoordModeOrigin, windows[idx].p, white,
 			2, line);
 
 		paint(idx);
@@ -216,11 +216,11 @@ void *event_thread(void *param)
 				fprintf(stderr, "ButtonRelease on unknown window!\n");
 			else
 			{
-				if(bre->detail.id == Button1)
+				if(bre->detail.id == XCBButton1)
 					windows[idx].angv = -windows[idx].angv;
-				else if(bre->detail.id == Button4)
+				else if(bre->detail.id == XCBButton4)
 					windows[idx].angv += 0.001;
-				else if(bre->detail.id == Button5)
+				else if(bre->detail.id == XCBButton5)
 					windows[idx].angv -= 0.001;
 			}
 		}
diff --git a/xcb-demo/main.c b/xcb-demo/main.c
index 0a81a57..205511b 100644
--- a/xcb-demo/main.c
+++ b/xcb-demo/main.c
@@ -87,22 +87,23 @@ int main(int argc, char **argv)
     values[1] = root->black_pixel;
 
     mask |= XCBCWBackingStore;
-    values[2] = Always;
+    values[2] = XCBBackingStoreAlways;
 
     mask |= XCBCWOverrideRedirect;
     values[3] = 0;
 
     mask |= XCBCWEventMask;
-    values[4] = ButtonReleaseMask | ExposureMask | StructureNotifyMask
-        | EnterWindowMask | LeaveWindowMask;
+    values[4] = XCBEventMaskButtonRelease
+        | XCBEventMaskExposure | XCBEventMaskStructureNotify
+        | XCBEventMaskEnterWindow | XCBEventMaskLeaveWindow;
 
     mask |= XCBCWDontPropagate;
-    values[5] = ButtonPressMask;
+    values[5] = XCBEventMaskButtonPress;
 
     XCBCreateWindow(c, /* depth */ 0,
         window, root->root,
         /* x */ 20, /* y */ 200, /* width */ 150, /* height */ 150,
-        /* border_width */ 10, /* class */ InputOutput,
+        /* border_width */ 10, /* class */ XCBWindowClassInputOutput,
         /* visual */ root->root_visual, mask, values);
 #ifdef TEST_ICCCM
     atom[0] = XCBInternAtom(c, 0, sizeof("WM_PROTOCOLS")-1, "WM_PROTOCOLS");
@@ -112,14 +113,14 @@ int main(int argc, char **argv)
     {
         XCBATOM XA_WM_NAME = { 39 };
         XCBATOM XA_STRING = { 31 };
-        XCBChangeProperty(c, PropModeReplace, window, XA_WM_NAME, XA_STRING, 8, strlen(argv[0]), argv[0]);
+        XCBChangeProperty(c, XCBPropModeReplace, window, XA_WM_NAME, XA_STRING, 8, strlen(argv[0]), argv[0]);
     }
     if(atomrep[0] && atomrep[1])
     {
         XCBATOM WM_PROTOCOLS = atomrep[0]->atom;
         XCBATOM WM_DELETE_WINDOW = atomrep[1]->atom;
         XCBATOM XA_ATOM = { 4 };
-        XCBChangeProperty(c, PropModeReplace, window, WM_PROTOCOLS, XA_ATOM, 32, 1, &WM_DELETE_WINDOW);
+        XCBChangeProperty(c, XCBPropModeReplace, window, WM_PROTOCOLS, XA_ATOM, 32, 1, &WM_DELETE_WINDOW);
     }
     free(atomrep[0]);
     free(atomrep[1]);
diff --git a/xcb-demo/rendertest.c b/xcb-demo/rendertest.c
index 9a2840d..73b0ef3 100644
--- a/xcb-demo/rendertest.c
+++ b/xcb-demo/rendertest.c
@@ -186,7 +186,7 @@ int draw_window(XCBConnection *conn, XCB
             0, 0,   /* x and y */
             600, 600,   /* width and height */
             0,  /* border width */
-            InputOutput,    /* class */
+            XCBWindowClassInputOutput,    /* class */
             root->root_visual,   /* XCBVISUALID */
             value_mask, value_list); /* LISTofVALUES */
     
diff --git a/xcb-demo/xcbrandr.c b/xcb-demo/xcbrandr.c
index 44b3f3e..17aab3f 100644
--- a/xcb-demo/xcbrandr.c
+++ b/xcb-demo/xcbrandr.c
@@ -137,7 +137,7 @@ main (int argc, char **argv)
   int		width = 0, height = 0;
   int		have_pixel_size = 0;
   XCBGenericError *err;
-  CARD16 mask = (CARD16) StructureNotifyMask;
+  CARD16 mask = (CARD16) XCBEventMaskStructureNotify;
   CARD32 values[1];
   XCBRandRGetScreenInfoCookie scookie;
   int major_version, minor_version;
@@ -409,9 +409,6 @@ main (int argc, char **argv)
 	XRRUpdateConfiguration (&event);
 #endif
 	
-	if (event->response_type == ConfigureNotify)
-	  printf("Received ConfigureNotify Event!\n");
-	
 	switch (event->response_type - event_base) {
 	case XCBRandRScreenChangeNotify:
 	  sce = (XCBRandRScreenChangeNotifyEvent *) event;
@@ -437,7 +434,9 @@ main (int argc, char **argv)
 	  else printf ("new Subpixel rendering model is %s\n", order[spo]);
 	  break;
 	default:
-	  if (event->response_type != ConfigureNotify) 
+	  if (event->response_type == XCBConfigureNotify)
+	    printf("Received ConfigureNotify Event!\n");
+          else
 	    printf("unknown event received, type = %d!\n", event->response_type);
 	}
 	}
diff --git a/xcb-demo/xdpyinfo.c b/xcb-demo/xdpyinfo.c
index 3b3717d..ba45862 100644
--- a/xcb-demo/xdpyinfo.c
+++ b/xcb-demo/xdpyinfo.c
@@ -51,8 +51,8 @@ void print_setup()
     /* "\n" "XFree86 version: %d.%d.%d.%d" */
     printf("\n" "maximum request size:  %d bytes", XCBGetSetup(c)->maximum_request_length * 4);
     printf("\n" "motion buffer size:  %d", (int)XCBGetSetup(c)->motion_buffer_size);
-    printf("\n" "bitmap unit, bit order, padding:    %d, %s, %d", XCBGetSetup(c)->bitmap_format_scanline_unit, (XCBGetSetup(c)->bitmap_format_bit_order == LSBFirst) ? "LSBFirst" : "MSBFirst", XCBGetSetup(c)->bitmap_format_scanline_pad);
-    printf("\n" "image byte order:    %s", (XCBGetSetup(c)->image_byte_order == LSBFirst) ? "LSBFirst" : "MSBFirst");
+    printf("\n" "bitmap unit, bit order, padding:    %d, %s, %d", XCBGetSetup(c)->bitmap_format_scanline_unit, (XCBGetSetup(c)->bitmap_format_bit_order == XCBImageOrderLSBFirst) ? "LSBFirst" : "MSBFirst", XCBGetSetup(c)->bitmap_format_scanline_pad);
+    printf("\n" "image byte order:    %s", (XCBGetSetup(c)->image_byte_order == XCBImageOrderLSBFirst) ? "LSBFirst" : "MSBFirst");
 
     print_formats();
 
diff --git a/xcb-proto/src/xproto.xml b/xcb-proto/src/xproto.xml
index e4e1bf6..3571ae1 100644
--- a/xcb-proto/src/xproto.xml
+++ b/xcb-proto/src/xproto.xml
@@ -369,6 +369,12 @@ authorization from the authors.
     <item name="Colormap">        <bit bit="13" /></item>
     <item name="Cursor">          <bit bit="14" /></item>
   </enum>
+  
+  <enum name="BackingStore">
+    <item name="NotUseful"> <value>0</value></item>
+    <item name="WhenMapped"><value>1</value></item>
+    <item name="Always">    <value>2</value></item>
+  </enum>
 
   <enum name="EventMask">
     <item name="NoEvent">           <value>0</value></item>
@@ -695,6 +701,15 @@ authorization from the authors.
     <field type="TIMESTAMP" name="time" />
   </request>
 
+  <enum name="Button">
+     <item name="Any"><value>0</value></item>
+     <item name="1">  <value>1</value></item>
+     <item name="2">  <value>2</value></item>
+     <item name="3">  <value>3</value></item>
+     <item name="4">  <value>4</value></item>
+     <item name="5">  <value>5</value></item>
+  </enum>
+
   <request name="GrabButton" opcode="28">
     <field type="BOOL" name="owner_events" />
     <field type="WINDOW" name="grab_window" />
@@ -1114,6 +1129,11 @@ authorization from the authors.
     <field type="CARD16" name="height" />
     <field type="CARD32" name="bit_plane" />
   </request>
+  
+  <enum name="CoordMode">
+    <item name="Origin">  <value>0</value></item>
+    <item name="Previous"><value>1</value></item>
+  </enum>
 
   <request name="PolyPoint" opcode="64" combine-adjacent="true">
     <field type="BYTE" name="coordinate_mode" />
diff --git a/xcb/src/xcb.h b/xcb/src/xcb.h
index 9920c85..7998d20 100644
--- a/xcb/src/xcb.h
+++ b/xcb/src/xcb.h
@@ -84,6 +84,8 @@ extern "C" {
 /** XCBNone is the universal null resource or null atom parameter value for many core X requests */
 #define XCBNone 0L
 
+/** XCBCopyFromParent can be used for many CreateWindow parameters */
+#define XCBCopyFromParent 0L
 
 /* Opaque structures */
 
diff-tree df7e48d7bcbd2c978ed714251f885bc6fc3b2e57 (from cae6ea76bd670f37c63707b2fa3f4f6392fb20db)
Author: Ian Osgood <iano at quirkster.com>
Date:   Tue Mar 14 18:23:37 2006 -0800

    Remove xcb-util dependency on proto/X11
    by moving many defs from X.h to <enum>s in xproto.xml

diff --git a/xcb-proto/src/xproto.xml b/xcb-proto/src/xproto.xml
index e0137dd..e4e1bf6 100644
--- a/xcb-proto/src/xproto.xml
+++ b/xcb-proto/src/xproto.xml
@@ -237,6 +237,11 @@ authorization from the authors.
 
   <eventcopy name="CirculateRequest" number="27" ref="CirculateNotify" />
 
+  <enum name="Property">
+    <item name="NewValue"><value>0</value></item>
+    <item name="Delete">  <value>1</value></item>
+  </enum>
+
   <event name="PropertyNotify" number="28">
     <pad bytes="1" />
     <field type="WINDOW" name="window" />
@@ -294,6 +299,12 @@ authorization from the authors.
     <field type="ClientMessageData" name="data" />
   </event>
 
+  <enum name="Mapping">
+    <item name="Modifier"><value>0</value></item>
+    <item name="Keyboard"><value>1</value></item>
+    <item name="Pointer"> <value>2</value></item>
+  </enum>
+
   <event name="MappingNotify" number="34">
     <pad bytes="1" />
     <field type="BYTE" name="request" />
@@ -334,23 +345,58 @@ authorization from the authors.
 
   <!-- FIXME: The ListFontsWithInfo request is not supported by XCB. -->
 
+  <enum name="WindowClass">
+    <item name="CopyFromParent"><value>0</value></item>
+    <item name="InputOutput">   <value>1</value></item>
+    <item name="InputOnly">     <value>2</value></item>
+  </enum>
+
   <!-- Window attributes for CreateWindow and ChangeWindowAttributes. -->
   <enum name="CW">
-    <item name="BackPixmap">      <bit bit="0"/></item>
-    <item name="BackPixel">       <bit bit="1"/></item>
-    <item name="BorderPixmap">    <bit bit="2"/></item>
-    <item name="BorderPixel">     <bit bit="3"/></item>
-    <item name="BitGravity">      <bit bit="4"/></item>
-    <item name="WinGravity">      <bit bit="5"/></item>
-    <item name="BackingStore">    <bit bit="6"/></item>
-    <item name="BackingPlanes">   <bit bit="7"/></item>
-    <item name="BackingPixel">    <bit bit="8"/></item>
-    <item name="OverrideRedirect"><bit bit="9"/></item>
-    <item name="SaveUnder">       <bit bit="10"/></item>
-    <item name="EventMask">       <bit bit="11"/></item>
-    <item name="DontPropagate">   <bit bit="12"/></item>
-    <item name="Colormap">        <bit bit="13"/></item>
-    <item name="Cursor">          <bit bit="14"/></item>
+    <item name="BackPixmap">      <bit bit="0" /></item>
+    <item name="BackPixel">       <bit bit="1" /></item>
+    <item name="BorderPixmap">    <bit bit="2" /></item>
+    <item name="BorderPixel">     <bit bit="3" /></item>
+    <item name="BitGravity">      <bit bit="4" /></item>
+    <item name="WinGravity">      <bit bit="5" /></item>
+    <item name="BackingStore">    <bit bit="6" /></item>
+    <item name="BackingPlanes">   <bit bit="7" /></item>
+    <item name="BackingPixel">    <bit bit="8" /></item>
+    <item name="OverrideRedirect"><bit bit="9" /></item>
+    <item name="SaveUnder">       <bit bit="10" /></item>
+    <item name="EventMask">       <bit bit="11" /></item>
+    <item name="DontPropagate">   <bit bit="12" /></item>
+    <item name="Colormap">        <bit bit="13" /></item>
+    <item name="Cursor">          <bit bit="14" /></item>
+  </enum>
+
+  <enum name="EventMask">
+    <item name="NoEvent">           <value>0</value></item>
+    <item name="KeyPress">            <bit bit="0" /></item>
+    <item name="KeyRelease">          <bit bit="1" /></item>
+    <item name="ButtonPress">         <bit bit="2" /></item>
+    <item name="ButtonRelease">       <bit bit="3" /></item>
+    <item name="EnterWindow">         <bit bit="4" /></item>
+    <item name="LeaveWindow">         <bit bit="5" /></item>
+    <item name="PointerMotion">       <bit bit="6" /></item>
+    <item name="PointerMotionHint">   <bit bit="7" /></item>
+    <item name="Button1Motion">       <bit bit="8" /></item>
+    <item name="Button2Motion">       <bit bit="9" /></item>
+    <item name="Button3Motion">       <bit bit="10" /></item>
+    <item name="Button4Motion">       <bit bit="11" /></item>
+    <item name="Button5Motion">       <bit bit="12" /></item>
+    <item name="ButtonMotion">        <bit bit="13" /></item>
+    <item name="KeymapState">         <bit bit="14" /></item>
+    <item name="Exposure">            <bit bit="15" /></item>
+    <item name="VisibilityChange">    <bit bit="16" /></item>
+    <item name="StructureNotify">     <bit bit="17" /></item>
+    <item name="ResizeRedirect">      <bit bit="18" /></item>
+    <item name="SubstructureNotify">  <bit bit="19" /></item>
+    <item name="SubstructureRedirect"><bit bit="20" /></item>
+    <item name="FocusChange">         <bit bit="21" /></item>
+    <item name="PropertyChange">      <bit bit="22" /></item>
+    <item name="ColorMapChange">      <bit bit="23" /></item>
+    <item name="OwnerGrabButton">     <bit bit="24" /></item>
   </enum>
 
   <request name="CreateWindow" opcode="1">
@@ -376,6 +422,12 @@ authorization from the authors.
                 value-mask-name="value_mask"
                 value-list-name="value_list" />
   </request>
+  
+  <enum name="MapState">
+    <item name="Unmapped">  <value>0</value></item>
+    <item name="Unviewable"><value>1</value></item>
+    <item name="Viewable">  <value>2</value></item>
+  </enum>
 
   <request name="GetWindowAttributes" opcode="3">
     <pad bytes="1" />
@@ -408,6 +460,11 @@ authorization from the authors.
     <pad bytes="1" />
     <field type="WINDOW" name="window" />
   </request>
+  
+  <enum name="SetMode">
+    <item name="Insert"><value>0</value></item>
+    <item name="Delete"><value>1</value></item>
+  </enum>
 
   <request name="ChangeSaveSet" opcode="6">
     <field type="BYTE" name="mode" />
@@ -441,6 +498,16 @@ authorization from the authors.
     <pad bytes="1" />
     <field type="WINDOW" name="window" />
   </request>
+  
+  <enum name="ConfigWindow">
+    <item name="X">          <bit bit="0" /></item>
+    <item name="Y">          <bit bit="1" /></item>
+    <item name="Width">      <bit bit="2" /></item>
+    <item name="Height">     <bit bit="3" /></item>
+    <item name="BorderWidth"><bit bit="4" /></item>
+    <item name="Sibling">    <bit bit="5" /></item>
+    <item name="StackMode">  <bit bit="6" /></item>
+  </enum>
 
   <request name="ConfigureWindow" opcode="12">
     <pad bytes="1" />
@@ -509,6 +576,12 @@ authorization from the authors.
       </list>
     </reply>
   </request>
+  
+  <enum name="PropMode">
+    <item name="Replace"><value>0</value></item>
+    <item name="Prepend"><value>1</value></item>
+    <item name="Append"> <value>2</value></item>
+  </enum>
 
   <request name="ChangeProperty" opcode="18">
     <field type="CARD8" name="mode" />
@@ -534,6 +607,10 @@ authorization from the authors.
     <field type="WINDOW" name="window" />
     <field type="ATOM" name="property" />
   </request>
+  
+  <enum name="GetPropertyType">
+    <item name="Any"><value>0</value></item>
+  </enum>
 
   <request name="GetProperty" opcode="20">
     <field type="BOOL" name="delete" />
@@ -928,6 +1005,32 @@ authorization from the authors.
     <pad bytes="1" />
     <field type="PIXMAP" name="pixmap" />
   </request>
+  
+  <enum name="GC">
+    <item name="Function">          <bit bit="0" /> </item>
+    <item name="PlaneMask">         <bit bit="1" /> </item>
+    <item name="Foreground">        <bit bit="2" /> </item>
+    <item name="Background">        <bit bit="3" /> </item>
+    <item name="LineWidth">         <bit bit="4" /> </item>
+    <item name="LineStyle">         <bit bit="5" /> </item>
+    <item name="CapStyle">          <bit bit="6" /> </item>
+    <item name="JoinStyle">         <bit bit="7" /> </item>
+    <item name="FillStyle">         <bit bit="8" /> </item>
+    <item name="FillRule">          <bit bit="9" /> </item>
+    <item name="Tile">              <bit bit="10" /> </item>
+    <item name="Stipple">           <bit bit="11" /> </item>
+    <item name="TileStippleOriginX"><bit bit="12" /> </item>
+    <item name="TileStippleOriginY"><bit bit="13" /> </item>
+    <item name="Font">              <bit bit="14" /> </item>
+    <item name="SubwindowMode">     <bit bit="15" /> </item>
+    <item name="GraphicsExposures"> <bit bit="16" /> </item>
+    <item name="ClipOriginX">       <bit bit="17" /> </item>
+    <item name="ClipOriginY">       <bit bit="18" /> </item>
+    <item name="Mask">              <bit bit="19" /> </item>
+    <item name="DashOffset">        <bit bit="20" /> </item>
+    <item name="DashList">          <bit bit="21" /> </item>
+    <item name="ArcMode">           <bit bit="22" /> </item>
+  </enum>
 
   <request name="CreateGC" opcode="55">
     <pad bytes="1" />
@@ -1081,6 +1184,17 @@ authorization from the authors.
     <field type="GCONTEXT" name="gc" />
     <list type="ARC" name="arcs" />
   </request>
+  
+  <enum name="ImageFormat">
+    <item name="XYBitmap"><value>0</value></item>
+    <item name="XYPixmap"><value>1</value></item>
+    <item name="ZPixmap"> <value>2</value></item>
+  </enum>
+
+  <enum name="ImageOrder">
+    <item name="LSBFirst"><value>0</value></item>
+    <item name="MSBFirst"><value>1</value></item>
+  </enum>
 
   <request name="PutImage" opcode="72">
     <field type="CARD8" name="format" />
diff --git a/xcb-util/icccm/icccm.c b/xcb-util/icccm/icccm.c
index 46d2c5a..90e4870 100644
--- a/xcb-util/icccm/icccm.c
+++ b/xcb-util/icccm/icccm.c
@@ -12,7 +12,7 @@ SetWMName (XCBConnection *c,
 	   CARD32         name_len,
 	   const char    *name)
 {
-	XCBChangeProperty(c, PropModeReplace, window, WM_NAME, encoding, 8, name_len, name);
+	XCBChangeProperty(c, XCBPropModeReplace, window, WM_NAME, encoding, 8, name_len, name);
 }
 
 int
@@ -63,7 +63,7 @@ SetWMIconName (XCBConnection *c,
 	       CARD32         name_len,
 	       const char    *name)
 {
-	XCBChangeProperty(c, PropModeReplace, window, WM_ICON_NAME, encoding, 8, name_len, name);
+	XCBChangeProperty(c, XCBPropModeReplace, window, WM_ICON_NAME, encoding, 8, name_len, name);
 }
 
 void
@@ -416,7 +416,7 @@ SetWMSizeHints (XCBConnection *c,
 		XCBATOM         property,
 		SizeHints      *hints)
 {
-	XCBChangeProperty(c, PropModeReplace, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints);
+	XCBChangeProperty(c, XCBPropModeReplace, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints);
 }
 
 int
@@ -752,7 +752,7 @@ SetWMProtocols (XCBConnection *c,
 	proto = InternAtomFast(c, 0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS");
 	WM_PROTOCOLS = InternAtomFastReply(c, proto, 0);
 
-	XCBChangeProperty(c, PropModeReplace, window, WM_PROTOCOLS, ATOM, 32, list_len, list);
+	XCBChangeProperty(c, XCBPropModeReplace, window, WM_PROTOCOLS, ATOM, 32, list_len, list);
 }
 
 int
diff --git a/xcb-util/image/xcb_image.c b/xcb-util/image/xcb_image.c
index ec0f8e1..40e4b2a 100644
--- a/xcb-util/image/xcb_image.c
+++ b/xcb-util/image/xcb_image.c
@@ -84,6 +84,15 @@ xcb_scanline_pad_get (XCBConnection *con
 /*   return XCBGetSetup (conn)->bitmap_format_scanline_pad; */
 }
 
+static int format_invalid(CARD8 depth, CARD8 format, CARD8 xpad)
+{
+  return (depth == 0 || depth > 32 ||
+      (format != XCBImageFormatXYBitmap &&
+       format != XCBImageFormatXYPixmap &&
+       format != XCBImageFormatZPixmap) ||
+      (format == XCBImageFormatXYBitmap && depth != 1) ||
+      (xpad != 8 && xpad != 16 && xpad != 32));
+}
 
 XCBImage *
 XCBImageCreate (XCBConnection *conn,
@@ -100,10 +109,7 @@ XCBImageCreate (XCBConnection *conn,
   XCBConnSetupSuccessRep *rep;
   CARD8                   bpp = 1; /* bits per pixel */
 
-  if (depth == 0 || depth > 32 ||
-      (format != XYBitmap && format != XYPixmap && format != ZPixmap) ||
-      (format == XYBitmap && depth != 1) ||
-      (xpad != 8 && xpad != 16 && xpad != 32))
+  if (format_invalid(depth, format, xpad))
     return (XCBImage *) NULL;
 
   image = (XCBImage *)malloc (sizeof (XCBImage));
@@ -120,7 +126,7 @@ XCBImageCreate (XCBConnection *conn,
   image->bitmap_format_bit_order = rep->bitmap_format_bit_order;
   image->bitmap_format_scanline_pad = xpad;
   
-  if (format == ZPixmap) 
+  if (format == XCBImageFormatZPixmap) 
     {
       bpp = xcb_bits_per_pixel (conn, depth);
     }
@@ -134,7 +140,7 @@ XCBImageCreate (XCBConnection *conn,
    */
   if (bytes_per_line == 0)
     {
-      if (format == ZPixmap)
+      if (format == XCBImageFormatZPixmap)
 	image->bytes_per_line = 
 	  xcb_bytes_per_line (image->bitmap_format_scanline_pad,
 			      width, bpp);
@@ -154,14 +160,7 @@ XCBImageCreate (XCBConnection *conn,
 int
 XCBImageInit (XCBImage *image)
 {
-  if ((image->depth == 0 || image->depth > 32) ||
-      (image->format != XYBitmap &&
-       image->format != XYPixmap &&
-       image->format != ZPixmap) ||
-      (image->format == XYBitmap && image->depth != 1) ||
-      (image->bitmap_format_scanline_pad != 8 &&
-       image->bitmap_format_scanline_pad != 16 &&
-       image->bitmap_format_scanline_pad != 32))
+  if (format_invalid(image->depth, image->format, image->bitmap_format_scanline_pad))
     return 0;
   
   /*
@@ -169,7 +168,7 @@ XCBImageInit (XCBImage *image)
    */
   if (image->bytes_per_line == 0)
     {
-      if (image->format == ZPixmap)
+      if (image->format == XCBImageFormatZPixmap)
 	image->bytes_per_line = 
 	  xcb_bytes_per_line (image->bitmap_format_scanline_pad,
 			      image->width,
@@ -224,7 +223,7 @@ XCBImageGet (XCBConnection *conn,
     return NULL;
   memcpy(data, XCBGetImageData (rep), XCBGetImageDataLength (rep));
 
-  if (format == XYPixmap)
+  if (format == XCBImageFormatXYPixmap)
     {
       image = XCBImageCreate (conn,
 				Ones (plane_mask & _lomask(rep->depth)),
@@ -235,11 +234,11 @@ XCBImageGet (XCBConnection *conn,
 				xcb_scanline_pad_get (conn, rep->depth),
 				0);
     }
-  else /* format == ZPixmap */
+  else /* format == XCBImageFormatZPixmap */
     {
       image = XCBImageCreate (conn,
 				rep->depth,
-				ZPixmap,
+				XCBImageFormatZPixmap,
 				0,
 				data,
 				width, height,
@@ -296,7 +295,7 @@ XCBImagePut (XCBConnection *conn,
   if ((w <= 0) || (h <= 0))
     return 0;
 
-  if ((image->bits_per_pixel == 1) || (image->format != ZPixmap))
+  if ((image->bits_per_pixel == 1) || (image->format != XCBImageFormatZPixmap))
     {
       dest_bits_per_pixel = 1;
       dest_scanline_pad = XCBGetSetup (conn)->bitmap_format_scanline_pad;
@@ -327,7 +326,7 @@ XCBImagePut (XCBConnection *conn,
 	img.width = width;
 	img.height = height;
 	img.xoffset = 0;
-	img.format = ZPixmap;
+	img.format = XCBImageFormatZPixmap;
 	img.image_byte_order = rep->image_byte_order;
 	img.bitmap_format_scanline_unit = rep->bitmap_format_scanline_unit;
 	img.bitmap_format_bit_order = rep->bitmap_format_bit_order;
@@ -404,7 +403,7 @@ XCBImageSHMCreate (XCBConnection *conn,
   image->bitmap_format_bit_order = rep->bitmap_format_bit_order;
   image->bitmap_format_scanline_pad = xcb_scanline_pad_get (conn, depth);
 
-  if (format == ZPixmap)
+  if (format == XCBImageFormatZPixmap)
     image->bits_per_pixel = xcb_bits_per_pixel (conn, depth);
   else
     image->bits_per_pixel = 1;
@@ -487,13 +486,13 @@ XCBImageSHMGet (XCBConnection *conn,
 
 static inline int XYINDEX (int x, XCBImage *img, int *bitp)
 {
-  int mask = img->bitmap_format_scanline_unit - 1;
+ int mask = img->bitmap_format_scanline_unit - 1;
   int unit = (x + img->xoffset) & ~mask;
   int byte = (x + img->xoffset) & mask;
-  if (img->bitmap_format_bit_order == MSBFirst)
+  if (img->bitmap_format_bit_order == XCBImageOrderMSBFirst)
     byte = img->bitmap_format_scanline_unit - byte;
   *bitp = byte & 7;
-  if (img->image_byte_order == MSBFirst)
+  if (img->image_byte_order == XCBImageOrderMSBFirst)
     byte = img->bitmap_format_scanline_unit - byte;
   return (unit + byte) >> 3;
 }
@@ -516,7 +515,7 @@ XCBImagePutPixel (XCBImage *image, int x
 {
   register BYTE *src = image->data + (y * image->bytes_per_line);
 
-  if (image->format == XYPixmap || (image->bits_per_pixel | image->depth) == 1)
+  if (image->format == XCBImageFormatXYPixmap || (image->bits_per_pixel | image->depth) == 1)
     {
       int plane, bit;
       /* do least signif plane 1st */
@@ -528,7 +527,7 @@ XCBImagePutPixel (XCBImage *image, int x
 	}
     }
   else
-    if (image->format == ZPixmap)
+    if (image->format == XCBImageFormatZPixmap)
       {
 	src += ZINDEX(x, image);
 	if (image->bits_per_pixel == 4)
@@ -538,7 +537,7 @@ XCBImagePutPixel (XCBImage *image, int x
 	  /* if x is odd and byte order is LSB, or
 	   * if x is even and byte order is MSB, then
 	   * want high nibble; else want low nibble. */
-	  if ((x & 1) == (image->image_byte_order == LSBFirst))
+	  if ((x & 1) == (image->image_byte_order == XCBImageOrderLSBFirst))
 	  {
 	    mask = ~mask;
 	    pixel <<= 4;
@@ -548,7 +547,7 @@ XCBImagePutPixel (XCBImage *image, int x
 	else
 	{
 	  int nbytes = image->bits_per_pixel >> 3;
-	  int rev = image->image_byte_order == MSBFirst;
+	  int rev = image->image_byte_order == XCBImageOrderMSBFirst;
 	  if(rev)
 	    src += nbytes - 1;
 	  while (--nbytes >= 0)
@@ -575,7 +574,7 @@ XCBImageGetPixel (XCBImage *image, int x
   CARD32         pixel = 0;
   register BYTE *src = image->data + (y * image->bytes_per_line);
   
-  if (image->format == XYPixmap || (image->bits_per_pixel | image->depth) == 1)
+  if (image->format == XCBImageFormatXYPixmap || (image->bits_per_pixel | image->depth) == 1)
     {
       int plane, bit;
       src += XYINDEX(x, image, &bit);
@@ -587,7 +586,7 @@ XCBImageGetPixel (XCBImage *image, int x
 	}
     }
   else
-    if (image->format == ZPixmap)
+    if (image->format == XCBImageFormatZPixmap)
       {
 	src += ZINDEX(x, image);
 	if (image->bits_per_pixel == 4)
@@ -596,13 +595,13 @@ XCBImageGetPixel (XCBImage *image, int x
 	  /* if x is odd and byte order is LSB, or
 	   * if x is even and byte order is MSB, then
 	   * want high nibble; else want low nibble. */
-	  if ((x & 1) == (image->image_byte_order == LSBFirst))
+	  if ((x & 1) == (image->image_byte_order == XCBImageOrderLSBFirst))
 	    pixel >>= 4;
 	}
 	else
 	{
 	  int nbytes = image->bits_per_pixel >> 3;
-	  int rev = image->image_byte_order == MSBFirst;
+	  int rev = image->image_byte_order == XCBImageOrderMSBFirst;
 	  if(rev)
 	    src += nbytes - 1;
 	  while (--nbytes >= 0)
diff --git a/xcb-util/keysyms/keysyms.c b/xcb-util/keysyms/keysyms.c
index e3012d5..926e40d 100644
--- a/xcb-util/keysyms/keysyms.c
+++ b/xcb-util/keysyms/keysyms.c
@@ -177,7 +177,7 @@ int
 XCBRefreshKeyboardMapping (XCBKeySymbols         *syms,
 			   XCBMappingNotifyEvent *event)
 {
-  if (event->request == MappingKeyboard && syms) {
+  if (event->request == XCBMappingKeyboard && syms) {
     if (syms->tag == TAG_VALUE) {
       XCBKEYCODE     min_keycode;
       XCBKEYCODE     max_keycode;
diff --git a/xcb-util/property/prop.c b/xcb-util/property/prop.c
index e5375dd..cb857ca 100644
--- a/xcb-util/property/prop.c
+++ b/xcb-util/property/prop.c
@@ -24,7 +24,7 @@ struct PropertyHandlers {
 
 XCBGetPropertyCookie GetAnyProperty(XCBConnection *c, BOOL del, XCBWINDOW window, XCBATOM name, CARD32 long_len)
 {
-	static const XCBATOM type = { AnyPropertyType };
+	static const XCBATOM type = { XCBGetPropertyTypeAny };
 	return XCBGetProperty(c, del, window, name, type, 0, long_len);
 }
 
@@ -32,7 +32,7 @@ static int callHandler(XCBConnection *c,
 {
 	XCBGetPropertyRep *propr = 0;
 	int ret;
-	if(state != PropertyDelete)
+	if(state != XCBPropertyDelete)
 	{
 		XCBGetPropertyCookie cookie = GetAnyProperty(c, 0, window, atom, h->long_len);
 		propr = XCBGetPropertyReply(c, cookie, 0);
@@ -129,5 +129,5 @@ int rootOfScreen(XCBConnection *c, int s
 
 XCBVoidCookie sendToWindow(XCBConnection *c, XCBWINDOW root, const XCBClientMessageEvent *ev)
 {
-	return XCBSendEvent(c, /* propagate */ 0, root, SubstructureNotifyMask | SubstructureRedirectMask, (const char *) ev);
+	return XCBSendEvent(c, /* propagate */ 0, root, XCBEventMaskSubstructureNotify | XCBEventMaskSubstructureRedirect, (const char *) ev);
 }
diff --git a/xcb-util/wm/manage.c b/xcb-util/wm/manage.c
index b196055..68d85a8 100644
--- a/xcb-util/wm/manage.c
+++ b/xcb-util/wm/manage.c
@@ -16,7 +16,7 @@ void manageWindow(PropertyHandlers *prop
 		attr = XCBGetWindowAttributesReply(c, wa.u.cookie, 0);
 		if(!attr)
 			return;
-		if(attr->map_state != IsViewable)
+		if(attr->map_state != XCBMapStateViewable)
 		{
 			printf("Window 0x%08lx is not mapped. Ignoring.\n", window.xid);
 			free(attr);
@@ -48,7 +48,7 @@ void manageWindow(PropertyHandlers *prop
 	if(attr && geom)
 	{
 		reparentWindow(c, window, attr->visual, geom->root, geom->depth, geom->x, geom->y, geom->width, geom->height);
-		PropertyChanged(prophs, PropertyNewValue, window, WM_NAME);
+		PropertyChanged(prophs, XCBPropertyNewValue, window, WM_NAME);
 	}
 	free(attr);
 	free(geom);
diff --git a/xcb-util/wm/xcbwm-test.c b/xcb-util/wm/xcbwm-test.c
index 1de4ac2..c2455a2 100644
--- a/xcb-util/wm/xcbwm-test.c
+++ b/xcb-util/wm/xcbwm-test.c
@@ -50,7 +50,7 @@ static int handleButtonReleaseEvent(void
 	}
 	values[0] = /* x */ e->root_x;
 	values[1] = /* y */ e->root_y;
-	XCBConfigureWindow(c, e->event, CWX | CWY, values);
+	XCBConfigureWindow(c, e->event, XCBConfigWindowX | XCBConfigWindowY, values);
 	XCBFlush(c);
 	move_from_x = -1;
 	move_from_y = -1;
@@ -93,19 +93,19 @@ void reparentWindow(XCBConnection *c, XC
 	values[1] = 1;
 
 	mask |= XCBCWEventMask;
-	values[2] = ButtonPressMask | ButtonReleaseMask
-		| ExposureMask /* | EnterWindowMask | LeaveWindowMask */;
+	values[2] = XCBEventMaskButtonPress | XCBEventMaskButtonRelease
+		| XCBEventMaskExposure /* | XCBEventMaskEnterWindow | XCBEventMaskLeaveWindow */;
 
 	printf("Reparenting 0x%08lx under 0x%08lx.\n", child.xid, w.xid);
 	XCBCreateWindow(c, d, w, r, x, y,
 			width + LEFT + RIGHT, height + TOP + BOTTOM,
-			/* border_width */ 0, InputOutput, v, mask, values);
-	XCBChangeSaveSet(c, SetModeInsert, child);
+			/* border_width */ 0, XCBWindowClassInputOutput, v, mask, values);
+	XCBChangeSaveSet(c, XCBSetModeInsert, child);
 	XCBMapWindow(c, w);
 
 	titlegc = XCBGCONTEXTNew(c);
 
-	mask = GCForeground | GCBackground;
+	mask = XCBGCForeground | XCBGCBackground;
 	values[0] = root->black_pixel;
 	values[1] = root->white_pixel;
 	drawable.window = w;
@@ -115,7 +115,7 @@ void reparentWindow(XCBConnection *c, XC
 	XCBReparentWindow(c, child, w, LEFT - 1, TOP - 1);
 
 	mask = XCBCWEventMask;
-	values[0] = PropertyChangeMask | StructureNotifyMask;
+	values[0] = XCBEventMaskPropertyChange | XCBEventMaskStructureNotify;
 	XCBChangeWindowAttributes(c, child, mask, values);
 
 	XCBFlush(c);
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
 
 	{
 		CARD32 mask = XCBCWEventMask;
-		CARD32 values[] = { SubstructureNotifyMask | PropertyChangeMask };
+		CARD32 values[] = { XCBEventMaskSubstructureNotify | XCBEventMaskPropertyChange };
 		XCBChangeWindowAttributes(c, root, mask, values);
 	}
 	XCBFlush(c);
diff --git a/xcb/src/xcb.h b/xcb/src/xcb.h
index 27f57b8..9920c85 100644
--- a/xcb/src/xcb.h
+++ b/xcb/src/xcb.h
@@ -81,6 +81,10 @@ extern "C" {
 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
 
 
+/** XCBNone is the universal null resource or null atom parameter value for many core X requests */
+#define XCBNone 0L
+
+
 /* Opaque structures */
 
 /**
diff-tree cae6ea76bd670f37c63707b2fa3f4f6392fb20db (from 1d15f74a31c357a14e896767fea9f9c6ea62d6e8)
Author: Ian Osgood <iano at quirkster.com>
Date:   Tue Mar 14 11:53:01 2006 -0800

    Fix XCBGetSetup to match prototype.

diff --git a/xcb/src/xcb_conn.c b/xcb/src/xcb_conn.c
index 51f8eaa..1e93137 100644
--- a/xcb/src/xcb_conn.c
+++ b/xcb/src/xcb_conn.c
@@ -169,7 +169,7 @@ static int write_vec(XCBConnection *c, s
 
 /* Public interface */
 
-XCBConnSetupSuccessRep *XCBGetSetup(XCBConnection *c)
+const XCBConnSetupSuccessRep *XCBGetSetup(XCBConnection *c)
 {
     /* doesn't need locking because it's never written to. */
     return c->setup;
diff-tree 1d15f74a31c357a14e896767fea9f9c6ea62d6e8 (from parents)
Merge: fa21f2a21bfb0c85de1278c34798ea6cfd9462bc 3af0b6d507c0759f3f441d8d76f4881c91224e31
Author: Ian Osgood <iano at quirkster.com>
Date:   Tue Mar 14 11:44:43 2006 -0800

    Merge branch 'master' of git+ssh://iano@git.freedesktop.org/git/xcb

diff-tree fa21f2a21bfb0c85de1278c34798ea6cfd9462bc (from 76da031f5f6d05d8ccaf67ccc36bb5dc31d97a86)
Author: Ian Osgood <iano at quirkster.com>
Date:   Tue Mar 14 10:18:22 2006 -0800

    Add an expression construct <bit bit="n"/>
    for mask enumerations such as CW flags.
    Replaces the C-specific use of 1<<n in xproto.xml

diff --git a/xcb-proto/src/xcb.xsd b/xcb-proto/src/xcb.xsd
index 8cac620..8b3e1fd 100644
--- a/xcb-proto/src/xcb.xsd
+++ b/xcb-proto/src/xcb.xsd
@@ -88,6 +88,11 @@ authorization from the authors.
       </xsd:element>
       <xsd:element name="fieldref" type="xsd:string" />
       <xsd:element name="value" type="dec-or-hex-integer" />
+      <xsd:element name="bit">
+        <xsd:complexType>
+          <xsd:attribute name="bit" type="xsd:integer" use="required" />
+        </xsd:complexType>
+      </xsd:element>
     </xsd:choice>
   </xsd:group>
   
diff --git a/xcb-proto/src/xproto.xml b/xcb-proto/src/xproto.xml
index 5033ff6..e0137dd 100644
--- a/xcb-proto/src/xproto.xml
+++ b/xcb-proto/src/xproto.xml
@@ -336,51 +336,21 @@ authorization from the authors.
 
   <!-- Window attributes for CreateWindow and ChangeWindowAttributes. -->
   <enum name="CW">
-    <item name="BackPixmap">
-      <op op="&lt;&lt;"><value>1</value><value>0</value></op>
-    </item>
-    <item name="BackPixel">
-      <op op="&lt;&lt;"><value>1</value><value>1</value></op>
-    </item>
-    <item name="BorderPixmap">
-      <op op="&lt;&lt;"><value>1</value><value>2</value></op>
-    </item>
-    <item name="BorderPixel">
-      <op op="&lt;&lt;"><value>1</value><value>3</value></op>
-    </item>
-    <item name="BitGravity">
-      <op op="&lt;&lt;"><value>1</value><value>4</value></op>
-    </item>
-    <item name="WinGravity">
-      <op op="&lt;&lt;"><value>1</value><value>5</value></op>
-    </item>
-    <item name="BackingStore">
-      <op op="&lt;&lt;"><value>1</value><value>6</value></op>
-    </item>
-    <item name="BackingPlanes">
-      <op op="&lt;&lt;"><value>1</value><value>7</value></op>
-    </item>
-    <item name="BackingPixel">
-      <op op="&lt;&lt;"><value>1</value><value>8</value></op>
-    </item>
-    <item name="OverrideRedirect">
-      <op op="&lt;&lt;"><value>1</value><value>9</value></op>
-    </item>
-    <item name="SaveUnder">
-      <op op="&lt;&lt;"><value>1</value><value>10</value></op>
-    </item>
-    <item name="EventMask">
-      <op op="&lt;&lt;"><value>1</value><value>11</value></op>
-    </item>
-    <item name="DontPropagate">
-      <op op="&lt;&lt;"><value>1</value><value>12</value></op>
-    </item>
-    <item name="Colormap">
-      <op op="&lt;&lt;"><value>1</value><value>13</value></op>
-    </item>
-    <item name="Cursor">
-      <op op="&lt;&lt;"><value>1</value><value>14</value></op>
-    </item>
+    <item name="BackPixmap">      <bit bit="0"/></item>
+    <item name="BackPixel">       <bit bit="1"/></item>
+    <item name="BorderPixmap">    <bit bit="2"/></item>
+    <item name="BorderPixel">     <bit bit="3"/></item>
+    <item name="BitGravity">      <bit bit="4"/></item>
+    <item name="WinGravity">      <bit bit="5"/></item>
+    <item name="BackingStore">    <bit bit="6"/></item>
+    <item name="BackingPlanes">   <bit bit="7"/></item>
+    <item name="BackingPixel">    <bit bit="8"/></item>
+    <item name="OverrideRedirect"><bit bit="9"/></item>
+    <item name="SaveUnder">       <bit bit="10"/></item>
+    <item name="EventMask">       <bit bit="11"/></item>
+    <item name="DontPropagate">   <bit bit="12"/></item>
+    <item name="Colormap">        <bit bit="13"/></item>
+    <item name="Cursor">          <bit bit="14"/></item>
   </enum>
 
   <request name="CreateWindow" opcode="1">
diff --git a/xcb/src/c-client.xsl b/xcb/src/c-client.xsl
index 054d84a..6306a5c 100644
--- a/xcb/src/c-client.xsl
+++ b/xcb/src/c-client.xsl
@@ -1089,6 +1089,12 @@ authorization from the authors.
     <xsl:text>)</xsl:text>
   </xsl:template>
 
+  <xsl:template match="bit" mode="output-expression">
+    <xsl:text>(1 &lt;&lt; </xsl:text>
+    <xsl:value-of select="@bit" />
+    <xsl:text>)</xsl:text>
+  </xsl:template>
+
   <xsl:template match="function-call" mode="output-expression">
     <xsl:param name="field-prefix" />
     <xsl:value-of select="@name" />


More information about the xcb-commit mailing list