Fix tutorial to use XCBSetup rather than the previous deprecated name XCBConnSetupSuccessRep.

This commit is contained in:
Josh Triplett 2006-04-27 16:24:35 -07:00
parent 34016bcdab
commit 08f5cc3892

View File

@ -679,7 +679,7 @@ typedef struct {
following function: following function:
</p> </p>
<pre class="code"> <pre class="code">
XCBSCREENIter XCBConnSetupSuccessRepRootsIter (XCBConnSetupSuccessRep *R); XCBSCREENIter XCBSetupRootsIter (XCBSetup *R);
</pre> </pre>
<p> <p>
Here is a small program that shows how to use this function: Here is a small program that shows how to use this function:
@ -701,7 +701,7 @@ main (int argc, char *argv[])
c = XCBConnect (NULL, &amp;screen_nbr); c = XCBConnect (NULL, &amp;screen_nbr);
/* Get the screen #screen_nbr */ /* Get the screen #screen_nbr */
iter = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)); iter = XCBSetupRootsIter (XCBGetSetup (c));
for (; iter.rem; --screen_nbr, XCBSCREENNext (&amp;iter)) for (; iter.rem; --screen_nbr, XCBSCREENNext (&amp;iter))
if (screen_nbr == 0) if (screen_nbr == 0)
{ {
@ -785,7 +785,7 @@ main (int argc, char *argv[])
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
/* Get the first screen */ /* Get the first screen */
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
/* Ask for our window's Id */ /* Ask for our window's Id */
win.window = XCBWINDOWNew(c); win.window = XCBWINDOWNew(c);
@ -931,7 +931,7 @@ main (int argc, char *argv[])
/* Open the connection to the X server and get the first screen */ /* Open the connection to the X server and get the first screen */
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
/* Create a black graphic context for drawing in the foreground */ /* Create a black graphic context for drawing in the foreground */
win.window = screen-&gt;root; win.window = screen-&gt;root;
@ -1318,7 +1318,7 @@ main (int argc, char *argv[])
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
/* Get the first screen */ /* Get the first screen */
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
/* Create black (foreground) graphic context */ /* Create black (foreground) graphic context */
win.window = screen-&gt;root; win.window = screen-&gt;root;
@ -1966,7 +1966,7 @@ main (int argc, char *argv[])
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
/* Get the first screen */ /* Get the first screen */
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
/* Ask for our window's Id */ /* Ask for our window's Id */
win.window = XCBWINDOWNew(c); win.window = XCBWINDOWNew(c);
@ -2218,7 +2218,7 @@ main (int argc, char *argv[])
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
/* Get the first screen */ /* Get the first screen */
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
/* Ask for our window's Id */ /* Ask for our window's Id */
win.window = XCBWINDOWNew(c); win.window = XCBWINDOWNew(c);
@ -2740,7 +2740,7 @@ main (int argc, char *argv[])
/* Open the connection to the X server and get the first screen */ /* Open the connection to the X server and get the first screen */
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
colormap = screen-&gt;default_colormap; colormap = screen-&gt;default_colormap;
@ -2786,7 +2786,7 @@ main (int argc, char *argv[])
/* Open the connection to the X server and get the first screen */ /* Open the connection to the X server and get the first screen */
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
/* We create the window win here*/ /* We create the window win here*/
@ -2888,7 +2888,7 @@ main (int argc, char *argv[])
/* Open the connection to the X server and get the first screen */ /* Open the connection to the X server and get the first screen */
c = XCBConnect (NULL, NULL); c = XCBConnect (NULL, NULL);
screen = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).data; screen = XCBSetupRootsIter (XCBGetSetup (c)).data;
/* We create the window win here*/ /* We create the window win here*/
@ -3088,7 +3088,7 @@ XCBVoidCookie XCBFreePixmap (XCBConnection *c, /* Pointer to the XCBConne
return some members of the <span class="code">Display</span> return some members of the <span class="code">Display</span>
structure. They are obtained by using a function that requires a structure. They are obtained by using a function that requires a
<span class="code">XCBConnection *</span> or a member of the <span class="code">XCBConnection *</span> or a member of the
<span class="code">XCBConnSetupSuccessRep</span> structure <span class="code">XCBSetup</span> structure
(via the function <span class="code">XCBGetSetup</span>), or (via the function <span class="code">XCBGetSetup</span>), or
a function that requires that structure. a function that requires that structure.
<ol> <ol>
@ -3139,7 +3139,7 @@ c = XCBConnect (display_name, &amp;screen_default_nbr);
You get the count of screens with the functions You get the count of screens with the functions
<span class="code">XCBGetSetup</span> <span class="code">XCBGetSetup</span>
and and
<span class="code">XCBConnSetupSuccessRepRootsIter</span> <span class="code">XCBSetupRootsIter</span>
(if you need to iterate): (if you need to iterate):
</p> </p>
<pre class="code"> <pre class="code">
@ -3148,14 +3148,14 @@ int screen_count;
/* you init the connection */ /* you init the connection */
screen_count = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)).rem; screen_count = XCBSetupRootsIter (XCBGetSetup (c)).rem;
/* screen_count contains now the count of screens */ /* screen_count contains now the count of screens */
</pre> </pre>
<p> <p>
If you don't want to iterate over the screens, a better way If you don't want to iterate over the screens, a better way
to get that number is to use to get that number is to use
<span class="code">XCBConnSetupSuccessRepRootsLength</span>: <span class="code">XCBSetupRootsLength</span>:
</p> </p>
<pre class="code"> <pre class="code">
XCBConnection *c; XCBConnection *c;
@ -3163,7 +3163,7 @@ int screen_count;
/* you init the connection */ /* you init the connection */
screen_count = XCBConnSetupSuccessRepRootsLength (XCBGetSetup (c)); screen_count = XCBSetupRootsLength (XCBGetSetup (c));
/* screen_count contains now the count of screens */ /* screen_count contains now the count of screens */
</pre> </pre>
@ -3173,7 +3173,7 @@ screen_count = XCBConnSetupSuccessRepRootsLength (XCBGetSetup (c));
the functions <span class="code">XCBGetSetup</span> the functions <span class="code">XCBGetSetup</span>
and and
<span <span
class="code">XCBConnSetupSuccessRepVendor</span>. Beware class="code">XCBSetupVendor</span>. Beware
that, unlike Xlib, the string returned by XCB is not that, unlike Xlib, the string returned by XCB is not
necessarily null-terminaled: necessarily null-terminaled:
</p> </p>
@ -3183,10 +3183,10 @@ char *vendor = NULL;
int length; int length;
/* you init the connection */ /* you init the connection */
length = XCBConnSetupSuccessRepVendorLength (XCBGetSetup (c)); length = XCBSetupVendorLength (XCBGetSetup (c));
vendor = (char *)malloc (length + 1); vendor = (char *)malloc (length + 1);
if (vendor) if (vendor)
memcpy (vendor, XCBConnSetupSuccessRepVendor (XCBGetSetup (c)), length); memcpy (vendor, XCBSetupVendor (XCBGetSetup (c)), length);
vendor[length] = '\0'; vendor[length] = '\0';
/* vendor contains now the name of the vendor. Must be freed when not used anymore */ /* vendor contains now the name of the vendor. Must be freed when not used anymore */
@ -3194,7 +3194,7 @@ vendor[length] = '\0';
<li class="subtitle"><a name="ProtocolVersion"></a>ProtocolVersion <li class="subtitle"><a name="ProtocolVersion"></a>ProtocolVersion
<p> <p>
You get the major version of the protocol in the You get the major version of the protocol in the
<span class="code">XCBConnSetupSuccessRep</span> <span class="code">XCBSetup</span>
structure, with the function <span class="code">XCBGetSetup</span>: structure, with the function <span class="code">XCBGetSetup</span>:
</p> </p>
<pre class="code"> <pre class="code">
@ -3210,7 +3210,7 @@ protocol_major_version = XCBGetSetup (c)-&gt;protocol_major_version;
<li class="subtitle"><a name="ProtocolRevision"></a>ProtocolRevision <li class="subtitle"><a name="ProtocolRevision"></a>ProtocolRevision
<p> <p>
You get the minor version of the protocol in the You get the minor version of the protocol in the
<span class="code">XCBConnSetupSuccessRep</span> <span class="code">XCBSetup</span>
structure, with the function <span class="code">XCBGetSetup</span>: structure, with the function <span class="code">XCBGetSetup</span>:
</p> </p>
<pre class="code"> <pre class="code">
@ -3226,7 +3226,7 @@ protocol_minor_version = XCBGetSetup (c)-&gt;protocol_minor_version;
<li class="subtitle"><a name="VendorRelease"></a>VendorRelease <li class="subtitle"><a name="VendorRelease"></a>VendorRelease
<p> <p>
You get the number of the release of the server hardware in the You get the number of the release of the server hardware in the
<span class="code">XCBConnSetupSuccessRep</span> <span class="code">XCBSetup</span>
structure, with the function <span class="code">XCBGetSetup</span>: structure, with the function <span class="code">XCBGetSetup</span>:
</p> </p>
<pre class="code"> <pre class="code">
@ -3247,7 +3247,7 @@ release_number = XCBGetSetup (c)-&gt;release_number;
<li class="subtitle"><a name="BitmapUnit"></a>BitmapUnit <li class="subtitle"><a name="BitmapUnit"></a>BitmapUnit
<p> <p>
You get the bitmap scanline unit in the You get the bitmap scanline unit in the
<span class="code">XCBConnSetupSuccessRep</span> <span class="code">XCBSetup</span>
structure, with the function <span class="code">XCBGetSetup</span>: structure, with the function <span class="code">XCBGetSetup</span>:
</p> </p>
<pre class="code"> <pre class="code">
@ -3263,7 +3263,7 @@ bitmap_format_scanline_unit = XCBGetSetup (c)-&gt;bitmap_format_scanline_unit;
<li class="subtitle"><a name="BitmapBitOrder"></a>BitmapBitOrder <li class="subtitle"><a name="BitmapBitOrder"></a>BitmapBitOrder
<p> <p>
You get the bitmap bit order in the You get the bitmap bit order in the
<span class="code">XCBConnSetupSuccessRep</span> <span class="code">XCBSetup</span>
structure, with the function <span class="code">XCBGetSetup</span>: structure, with the function <span class="code">XCBGetSetup</span>:
</p> </p>
<pre class="code"> <pre class="code">
@ -3279,7 +3279,7 @@ bitmap_format_bit_order = XCBGetSetup (c)-&gt;bitmap_format_bit_order;
<li class="subtitle"><a name="BitmapPad"></a>BitmapPad <li class="subtitle"><a name="BitmapPad"></a>BitmapPad
<p> <p>
You get the bitmap scanline pad in the You get the bitmap scanline pad in the
<span class="code">XCBConnSetupSuccessRep</span> <span class="code">XCBSetup</span>
structure, with the function <span class="code">XCBGetSetup</span>: structure, with the function <span class="code">XCBGetSetup</span>:
</p> </p>
<pre class="code"> <pre class="code">
@ -3295,7 +3295,7 @@ bitmap_format_scanline_pad = XCBGetSetup (c)-&gt;bitmap_format_scanline_pad;
<li class="subtitle"><a name="ImageByteOrder"></a>ImageByteOrder <li class="subtitle"><a name="ImageByteOrder"></a>ImageByteOrder
<p> <p>
You get the image byte order in the You get the image byte order in the
<span class="code">XCBConnSetupSuccessRep</span> <span class="code">XCBSetup</span>
structure, with the function <span class="code">XCBGetSetup</span>: structure, with the function <span class="code">XCBGetSetup</span>:
</p> </p>
<pre class="code"> <pre class="code">
@ -3346,7 +3346,7 @@ XCBSCREEN *ScreenOfDisplay (XCBConnection *c,
{ {
XCBSCREENIter iter; XCBSCREENIter iter;
iter = XCBConnSetupSuccessRepRootsIter (XCBGetSetup (c)); iter = XCBSetupRootsIter (XCBGetSetup (c));
for (; iter.rem; --screen, XCBSCREENNext (&amp;iter)) for (; iter.rem; --screen, XCBSCREENNext (&amp;iter))
if (screen == 0) if (screen == 0)
return iter.data; return iter.data;