I am developing an x-server implementation, and I want to make it as similar to the current one as possible. I read through the documentation, but I couldn't find anything specific. In particular, I'm trying to find a numbering scheme for windows. It seems to me that this is implementation specific.

Either way, I found this concerning window ids:

The most significant 11 bits of the XID indicate the client, leaving 21 bits for each client, giving each client 2^21 (= 2,097,152) XIDs.

I've read elsewhere that the max x-clients is 255: here and here.

Is there any clear documentation on how windows should be numbered?


Cygwin/X queries getdtablesize() for the maximum number of client connections allowed; by default Cygwin returns 32 from getdtablesize(). Cygwin/X Server Test Series release Test44, released on 2001-08-15, changed the maximum number of clients from 32 to 1024 by passing the square of getdtablesize() to setdtablesize().

  • Mac OS X X Source Code has an hard definition in include/xorg/misc.h :

    #define MAXCLIENTS 256

  • Some Old Unixes and RHEL > 4 are able to set it at runtime :

    -maxclients 64|128|256|512 Set the maximum number of clients allowed to connect to the X server. Acceptable values are 64, 128, 256 or 512.

  • X.org Server Source Code, Virtual Box X source code and some others share it.

Of course, as it is free software, Debian & Red Hat can change it and has raise it to 512.

So I guess that you can take as an hint that it should be between 256 and 512 on all modern computers. As far as I know, the only way to know it is when you receive the "Cannot connect to X" error.

BTW, numbering of xclient has 11 bits. Numbering and max clients are different issues. You can see numbering of each window with xlsclient -l.

  • Wow, I had almost given up on this. Thanks so much! – beatgammit Feb 16 '12 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.