[Xcb] Where should check for valid screen lie - libxcb or callers?

Alan Coopersmith alan.coopersmith at oracle.com
Sat Aug 25 13:12:24 PDT 2012


On 08/25/12 12:28 PM, Jeremy Huddleston Sequoia wrote:
> I feel more comfortable with #1.  I don't like the idea of applications having differing behaviors for handling this error.  If a client asks libxcb to connect to :0.1 and :0.1 doesn't exist, then the connection should fail.
> 
> That being said, I think a bit of a hybrid would be good.  I'd be up for using a different error code so clients could tell the difference between "no server is listening on that display" versus "the server which we were able to connect to doesn't know about that screen"

Fair enough - since it's right at connection setup, before anything has had
a chance to happen, the cost is low of retrying with a different screen if
you get a XCB_CONN_CLOSED_INVALID_SCREEN and really want to carry on, which
should be the uncommon case.

With the current patches on https://bugs.freedesktop.org/show_bug.cgi?id=53242
programs can also opt out easily if they don't care about the screen number.
For instance, xlsatoms, even with a patched libxcb, accepts any screen number
you throw at it, since it passes in NULL for screenp, since it just needs
screen-independent server state.   Similarly programs that want to deal with
multiple screens, such as a multihead window manager, can ignore that as well.

The only reason I can think of not to do this is if we're worried about programs
failing on unexpected error codes, but we'd never made a guarantee that more
error codes wouldn't be added in the future, have we?

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the Xcb mailing list