HI Brad,

Thanks for the pointer,  I tried adding this to GrapicsWindowX11::init
and checkEvents respectively but alas it does catch the window
close/destruction.   I also check for the DestroyNotify event too, and
this doesn't catch anything either.  Do I need to add anything else to
tell X that this window should respond to WM_DELETE_WINDOW?

I noted that Producer uses DestroyNotify, one associated with
RenderSurface that doesn't get called, and one in the seperate
KeyboardMouse thread that does get a DestroyNotify.
osgViewer::GraphicsWindowX11 is closest to Producer::RenderSurface.

Robert.

On 1/3/07, Hittle Bradley <[EMAIL PROTECTED]> wrote:
Hi Robert,

Looking back on my code, what I did was I had to catch the message in
my event loop.  I first started by declaring the message I wanted to
receive:

Atom deleteWindow = XInternAtom (display, "WM_DELETE_WINDOW", 0);

Next, in my event messaging I would check the type of event and if its
ClientMessage, I would check the data to see if it was this Atom:

switch (e.type)
{
case ClientMessage:
{
if (e.xclient.data.l[0] == deleteWindow)
//stop processing loop, and safely exit.
}
break;

...
}

I'll also include the manual I found pretty helpful:
http://tronche.com/gui/x/xlib/

-brad

>>> "Robert Osfield" <[EMAIL PROTECTED]> 1/3/2007 4:20 PM >>>
Hi X11 experts,

I have done most of the work on GraphicsWindowX11 at it for the most
part is working pretty well, I have windows opening across multiple
screens, running multi-threded with good stability and performance.
So far so good.

To do this work I've been learning X11, pretty well for the first
time, and its over 10 years since I did any serious Motify work so I'm
pretty out of touch on this side of things, let alone the lower level
stuff.  Consider me a newbee on the topic of X11, so I am need a bit
of expert instruction :-)

One area that the new code is lacking the handling of users pressing
the window close button when window decoration is up - right now the
GraphicsWindow doesn't know that the window has been destroyed, so the
viewer doesn't know to destruct all the associated threads and
graphics contexts or stop the main loop - so the main loop just
continues till X eventually kills the app due to errors.

What I am after is a callback that I can register to catch the
close/cancel button press or destroy of the window itself so I can
update the GraphicsWindow before the window gets destroyed.  I was
expecting this to be entirely straight forward, but while some parts
of X11 are obvious, this one doesn't seem to be.  Perhaps it is once
you know how.

I've done various searches on the most discussion seems to revolve
around Motify calls which doesn't help me here, as I'm staying with
low level and most portable X11 calls.

So please, offer up some wisdom on what bits of X11 I need to use and
how to use it to achieve the aim of catching the destruction of the
window.

Thanks in advance,
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to