|
Packit |
071ada |
.TH xcb-examples __libmansuffix__ __xorgversion__ "XCB examples"
|
|
Packit |
071ada |
.ad l
|
|
Packit |
071ada |
.SH NAME
|
|
Packit |
071ada |
xcb-examples \- manpage examples
|
|
Packit |
071ada |
.SH DESCRIPTION
|
|
Packit |
071ada |
Many of the XCB manpages contain example code. These examples intend to explain
|
|
Packit |
071ada |
how to use one particular part of XCB. They almost never represent a standalone
|
|
Packit |
071ada |
(or even useful) program - X11 programs are relatively involved and
|
|
Packit |
071ada |
thus beyond the scope of a manpage example.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
.SH ENVIRONMENT
|
|
Packit |
071ada |
|
|
Packit |
071ada |
Every example assumes you have an \fIxcb_connection\fP and possibly other
|
|
Packit |
071ada |
variables at hand. For illustrating how \fIxcb_get_property\fP works, you need
|
|
Packit |
071ada |
the window of which you want to get the property, for example. To make it clear
|
|
Packit |
071ada |
that these variables are your responsibility, these examples consist of a
|
|
Packit |
071ada |
single function which takes the necessary variables as parameters.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
.SH FLUSHING
|
|
Packit |
071ada |
|
|
Packit |
071ada |
Flushing means calling \fIxcb_flush\fP to clear the XCB-internal write buffer
|
|
Packit |
071ada |
and send all pending requests to the X11 server. You don't explicitly need to
|
|
Packit |
071ada |
flush before using a reply function (like \fIxcb_query_pointer_reply\fP), but
|
|
Packit |
071ada |
you do need to flush before entering the event loop of your program.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
There are only two cases when XCB flushes by itself. The first case is when
|
|
Packit |
071ada |
its write buffer becomes full, the second case is when you are asking for
|
|
Packit |
071ada |
the reply of a request which wasn't flushed out yet (like
|
|
Packit |
071ada |
\fIxcb_query_pointer_reply\fP). This last point also includes
|
|
Packit |
071ada |
xcb_request_check(). Please note that waiting for an event does \fBNOT\fP
|
|
Packit |
071ada |
flush.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
Examples generally include the \fIxcb_flush\fP call where appropriate (for
|
|
Packit |
071ada |
example after setting a property). Therefore, including these functions and
|
|
Packit |
071ada |
calling them in your application should just work. However, you might get
|
|
Packit |
071ada |
better results when flushing outside of the function, depending on the
|
|
Packit |
071ada |
architecture of your program.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
.SH COMPILATION
|
|
Packit |
071ada |
|
|
Packit |
071ada |
If an example does not compile (without warnings) when using \fI-std=c99\fP,
|
|
Packit |
071ada |
that is considered a documentation bug. Similarly, not handling errors or
|
|
Packit |
071ada |
leaking memory is also considered a documentation bug. Please inform us about
|
|
Packit |
071ada |
it on xcb@lists.freedesktop.org.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
.SH CODING STYLE
|
|
Packit |
071ada |
|
|
Packit |
071ada |
Every example uses 4 spaces for indentation.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
Comments are in asterisks, like /* this */.
|
|
Packit |
071ada |
|
|
Packit |
071ada |
No line is longer than 80 characters (including indentation).
|
|
Packit |
071ada |
|
|
Packit |
071ada |
.SH SEE ALSO
|
|
Packit |
071ada |
.BR xcb_connect (__libmansuffix__),
|
|
Packit |
071ada |
.BR xcb_get_property (__libmansuffix__),
|
|
Packit |
071ada |
.BR xcb_flush (__libmansuffix__)
|
|
Packit |
071ada |
.SH AUTHOR
|
|
Packit |
071ada |
Michael Stapelberg <michael+xcb at stapelberg dot de>
|