You can add an event handler and track the VisibilityNotify events, which can tell you whether the window is obscured or not. Some widgets, such as clocks, use this feature, as handled by Xt, to avoid doing extra processing if the window isn`t visible.
In addition, you can do XQueryTree() and confirm that your window is on top of the stacking order. Of course, if it isn`t, it may still not be obscured. And there are race conditions.
I`ve tried setting the VisibilityNotify event but there is still a problem how can I tell if the window is partially off screen vs. partially covered by other windows?
You can add an event handler and track the VisibilityNotify events, which can tell you whether the window is obscured or not. Some widgets, such as clocks, use this feature, as handled by Xt, to avoid doing extra processing if the window isn`t visible.
In addition, you can do XQueryTree() and confirm that your window is on top of the stacking order. Of course, if it isn`t, it may still not be obscured. And there are race conditions.
Thanks for the info.
I`ve tried setting the VisibilityNotify event but there is still a problem how can I tell if the window is partially off screen vs. partially covered by other windows?
dlei
Well, you know the window`s size and coordinates, so you can do an XTranslateCoordinates (http//www.motifzone.com/resources/man/XTranslateCoordinates.html) to get the boundaries in absolute terms.