[Xcb] Searching for tutorials observations

Bob bobk48 at gmail.com
Tue Aug 12 10:39:49 PDT 2014


Uli:
I've also tried to dissect the tutorial, from the top down and from the bottom up, and have found the code examples helpful from both ends. Still, something is missing for me. And I think it might be as follows-
Unless you have extensive experience in writing larger programs that take advantage of C "syntactic features" (for lack of a better description), and have many modules, I don't think that a beginner like myself can master Xcb client application programming. For example, the struct pointer operators, and how they reference values for all the Request, Event, and Error functions to me at least, seem to be addressing or working with a higher order data type that I'm not used to working with and have no real notion of. For Xcb and the X Protocol as message passers in the transport layer, that data type or types(?) and it's database are not easily understood by me as a beginner, or for me adequately explained by documentation, tutorials, examples, etc.. And probably they shouldn't be, because if you have done the kind of C programming that Xcb assumes you have done before you attempt a client application program, you don't really need docs, tutorials, examples!
As I commented in another email post to this list, doxygen, Z language, and any of the on-line documentation are opaque to me, from the perspective that they appear to assume a much more developed overview of Xcb than I  have.
To close, a typical example for me: xcb_button_press_event_t in the Events example in the tutorial has 4 struct pointer operators used to obtain values for printf. In all the docs I looked at, I couldn't find a description of what structure or listing they were drawn from.
Robert M. Koretsky

Sent from my iPad

On Aug 12, 2014, at 10:07 AM, Uli Schlachter <psychon at znc.in> wrote:

> Hi Patrick,
> 
> On 06.08.2014 23:09, Patrick wrote:
>> Hi Everyone
>> 
>> This is my first post here.
>> 
>> I am trying my very best to follow along with this tutorial:
>> http://www.x.org/releases/X11R7.6/doc/libxcb/tutorial/index.html
>> 
>> There is the reference manual and many tiny snippets of code on the 
>> internet. I am now understanding about 60-70% of what I need to 
>> understand, to use the library but I am still struggling with some topics.
> 
> Glad that you found the
> 
>> It looks like XCB_EVENT_MAKE_EVENT_HANDLER might have something to do 
>> with assigning a callback function but I can't find enough resources to 
>> understand it. Could anyone point me to a tutorial or other resource 
>> that would help me figure out how to call foo when the foo button(or 
>> window really) is pressed ? Right now I can understand button events but 
>> not how to distinguish between them.
> 
> Google tells me that XCB_EVENT_MAKE_EVENT_HANDLER comes from xcb-util's event
> helper library. I am not sure if that thing is really all that useful, so I
> would suggest not using it.
> 
> Instead you get events from e.g. xcb_wait_for_event(). This gives you a
> xcb_generic_event_t* which contains a reponse_type field. Button events have
> XCB_BUTTON_PRESS in this field and the event really is a
> xcb_button_press_event_t* in this case.
> 
> So the code could look something like:
> 
> xcb_generic_event_t *e = xcb_wait_for_event(connection);
> switch (e->response_type) {
> case XCB_BUTTON_PRESS: {
>     xcb_button_press_event_t *event = e;
>     printf("Button %d pressed\n", (int) event->detail);
>     break;
> }
> free(e);
> 
> However, I guess that your tutorial already explains this and the "Receiving
> events: writing the events loop"-section seems to be doing just that.
> 
> So I guess: Sorry, but I didn't get your question?
> 
>> The tutorial above also discussed how important pixmaps are but I still 
>> can't figure out how to write one to a window to turn that window into 
>> an image button and so on. Any resources for this would be great too.
> 
> The CopyArea request which xcb maps to xcb_copy_area() copies pixels between
> drawables. Drawables are pixmaps or windows ("A pixmap is a drawable" just as
> "water is a liquid",).
> 
>> Thanks for reading my post
> 
> Cheers,
> Uli
> -- 
> Happiness can't be found -- it finds you.
> - Majic
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the Xcb mailing list