[Techtalk] Using XChangeProperty function?

Vera Childs vera at dc-vc.net
Wed May 14 10:10:30 EST 2003


I've never done XWindows programming before, but I've been tasked to make a
Java program that stays on top of all other windows on the Linux platform
(Redhat 7.3 with Gnome 1.2/sawfish, to be specific). And yes, it really is
important in this particular case for the window to stay on top of all
windows, even though normally that would be a bad GUI practice.

I've got the Java program calling a C function that gets the drawing
surface and tries to change the properties of it at the X level. I've read
that this should work with my setup, but I've not been able to find an
example of the XChangeProperty function being used to change this
particular property (_NET_WM_STATE_ABOVE), only suggestions to use it. So
I've had to guess what to do here. It's not working (the window is not
staying on top), so any help would be appreciated. It compiles and runs
with no errors. I'm just not seeing the behavior I want to see.

The C code:
---
... includes and other variables ...

Window win;
Display dpy;
Atom stateAbove;

... stuff to set everything up ...

if (win) {
    stateAbove = XInternAtom(dpy, "_NET_WM_STATE_ABOVE", False);
    XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_STATE", False),
XA_ATOM, 32, PropModeReplace, (unsigned char *) &stateAbove, 1);
}

... clean up ...
---

Thanks!


-Vera




More information about the Techtalk mailing list