[Xcb] problem about fetching xcb_visualtype_t
Uli Schlachter
psychon at znc.in
Sat Oct 12 02:40:02 PDT 2013
Hi,
On 11.10.2013 17:28, 快乐迷宫 wrote:
> Hello, guys!
> I‘m now trying to use XCB instead of XLib of my program backend. And I'm trying to translate these few lines:
>
> XVisualInfo vinfo;
> XSetWindowAttributes attr;
> screen = DefaultScreen(display);
The DefaultScreen() isn't saved anywhere with xcb. For implementing this, you
need to pass a non-NULL pointer as the second argument to xcb_connect(). This
integer will then be set to the number of the default screen.
> XMatchVisualInfo(display, screen, 32, TrueColor, &vinfo); //create a transparent window
An example for doing the above with xcb can be found here (function
draw_argb_visual()):
http://git.naquadah.org/?p=awesome.git;a=blob;f=draw.c;h=1a0e4d8f93ca47723949e1e8763d7edbd4c64e5b;hb=HEAD#l261
> attr.colormap = XCreateColormap(display, rootwin, vinfo.visual, AllocNone);
> attr.override_redirect = 1; // ... and without the title-bar
>
> I found a tutor on this web-page, but while I was trying to get the xcb_visualtype_t structure, function screen_of_display() didn't seem existed. I tried xcb_setup_roots_iterator() instead, and the result was, I got a NULL xcb_visualtype_t *...
>
> -- screen = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
> => screen = screen_of_display (c, screen_nbr);
Are you saying that xcb_setup_roots_iterator(xcb_get_setup(c)).data is NULL? I
don't think that can really happen, this should work fine.
> So is there anyway I can create a transparent, no title-bar window and filling the window with cairo?
> Thanks!
Sure, you seem to be having almost all the ingredients already. I assume you are
porting some working code using Xlib to xcb, right?
Uli
--
Bruce Schneier can read and understand Perl programs.
More information about the Xcb
mailing list