Intercepting CLOSE_WINDOW in osgViewer

4 views
Skip to first unread message

James Turner

unread,
May 27, 2021, 6:48:54 AMMay 27
to OpenSceneGraph Users
I'd like to perform some custom action when the window frame's close action is triggered. The various native windows send an osgGA::GUIEventAdapter::CLOSE_WINDOW but this is handled directly by osgViewer::Viewer::eventTraversal. (Before any callbacks, etc, as far as I can see)

I can override eventTraversal() of course .. but since the events are retrieved from the GraphicsWindow inside the base version, I'd have to duplicate the code to take events, remove the close event, add all the other events *back*, and then call the base version of Viewer::eventTraversal.

That seems a pretty fragile way to go about it, is there a smarter solution I'm missing?

Kind regards,
James

Reply all
Reply to author
Forward
0 new messages