XCreateWindow gives the window identifier that collides with an existing window

I created a program that creates a window using XCreateWindow. This works fine on my system and many others, but on many, it causes some strange problems. for example, the identifier that I received from it collides with the identifier of the terminal from which the program starts. In one such case, gnome-terminal also has a window identifier of 0x2400001 (parent root), and my program window identifier is also 0x2400001 (its parent element is also the root). Any suggestions what could be wrong?

+3
source share
3 answers

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.

0
source

Xserver . , , , .

. ?

0

In addition to the other answers: run it xwininfo -root -all(read its man page for more information). Check the gnome-terminal window id and your application window id.

0
source

Source: https://habr.com/ru/post/1704055/


All Articles