Search code examples
cgraphicsxorgxcb

XCB xcb_window_t VS xcb_drawable_t


I'm trying to learn XCB through this link and write a little "library" so I don't forget what to do each time. I'm at the point where I have a window open and I'm almost ready to start drawing things. However something has confused me, in some of the earlier examples they use xcb_window_t but in the new ones the make the "window" variable a xcb_drawable_t. I just went with it before but now I'm at the section "Simple window operations" and the functions seem to use xcb_window_t as inputs. Can these be used interchangeably, or do they need to be their own thing?


Solution

  • There are two kinds of drawables in X11: Windows and pixmaps. Put differently: A window is a drawable and a pixmap is a drawable. Nothing else is a drawable.

    Every function that accepts a xcb_drawable_t can be called with either a window or a pixmap. Functions that want a window only accept xcb_window_t.