XSetWMName fails to set the window title

Glynn Clements glynn at gclements.plus.com
Tue Jun 12 08:33:33 PDT 2007


Jon Kristensen wrote:

> I have a little problem using the X11 library, and I thought there might
> be someone on this list that wanted to help me out a bit. If this mail
> is off-topic or something, then I'm sorry.
> 
> I want to set the window title, and below follows how I try to do it. I
> know that the window handle unsigned long is correct, becuase I've
> converted the number to hex and compared it to the output of `xwininfo'.
> 
> I get no errors, the window title just doesn't get set.
> 
> Any help would be greatly appreciated! :o)

> // Code for GNU systems goes here. We open the X11 display.
> static Display *display = XOpenDisplay (NULL);

You should use the Display* which is associated with the window. A
different Display* (even if it happens to refer to the same X server)
may not work, as the X server will see two different clients: one owns
the window, the other is calling XSetWMName(). The fact that both
connections belong to the same process doesn't count (X may not even
be aware of this, particularly if TCP connections are used).

Although I'm not certain that this is the cause of your problem, it
could be, and I don't see anything else wrong with the code.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list