[osg-users] GUIEventHandler::handle return value never used?

Gianni Ambrosio g.ambrosio+osg at gmail.com
Thu Aug 25 08:33:14 PDT 2016

Hi All,
is there anybody that can explain me please why (at least in OSG 3.4.0) in CompositeViewer.cpp, inside eventTraversal() method, the return value of GUIEventHandle::handle(...) is not used?
Here is a code snippet:


    for(ViewEventsMap::iterator veitr = viewEventsMap.begin();
        veitr != viewEventsMap.end();
        View* view = veitr->first;

        for(osgGA::EventQueue::Events::iterator itr = veitr->second.begin();
            itr != veitr->second.end();
            osgGA::Event* event = itr->get();
            for(View::EventHandlers::iterator hitr = view->getEventHandlers().begin();
                hitr != view->getEventHandlers().end();
                (*hitr)->handle( event, view, _eventVisitor.get());

Please look at the line:
(*hitr)->handle( event, view, _eventVisitor.get());

While GUIEventHandler::handle method returns bool as you can see in the following code:


bool GUIEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
    osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
    osgGA::GUIEventAdapter* ea = event->asGUIEventAdapter();
    if (ea && ev && ev->getActionAdapter())
#if 1
        bool handled = handle(*ea, *(ev->getActionAdapter()), object, nv);
        if (handled) ea->setHandled(true);
        return handled;


Read this topic online here:

More information about the osg-users mailing list