The window identifier is probably unique only in every connection to the X server (i.e. different processes connecting to the X server can receive the same window identifier, and server X uses the connection identifier AND and ID to separate them internally).
I think X does not make promises a window identifier, for example. they are unique in all processes or something else, so it’s better not to try to use them for any other purposes.
I would not be surprised to see X implementations that simply return consecutive numbers as window identifiers starting with the same value (e.g. 1) for each connection, which explains your experience, for example. the first window in each client seems to have the same window identifier as in the implementation of X.
source
share