[Xcb] DefaultScreen

Jamey Sharp jamey at minilop.net
Wed Dec 7 20:08:43 PST 2005

On Wed, Dec 07, 2005 at 07:31:36AM +0100, Vincent Torri wrote:
> Before, I would like to add in the tutorial how to translate the Xlib
> functions like DefaultScreen

That'd be great.

> And about DefaultScreen, as I talk about it :D, how can I get it ?
> in xcl (old version), it's:
> dpy->fd = XCBOpen(display_name, &dpy->default_screen);
> which is strange as XCBOpen takes an int and not an int * as 2nd
> parameter.
> So, i'm a bit confused.

This is one of the API warts I've been meaning to clean up for months.

The XCBConnect function, as documented on the XcbApi page but not yet
implemented, has exactly the interface that apparently XCBOpen had a
long time ago. And that's exactly the right interface for most
applications, I think.

At the moment, all you can do is call

	char *host = 0;
	int dsp;
	int screen;
	XCBParseDisplay(getenv("DISPLAY"), &host, &dsp, &screen);

and then screen will contain the same value as Xlib's DefaultScreen
would have returned. Ugly.

Note that I don't intend XCB to track the "default screen" number for
you, so when you're implementing ecore you should find out what the
screen is on startup and save it somewhere yourself.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20051207/9f5fa8fd/attachment.pgp

More information about the Xcb mailing list