[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:


Code:

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

        for(osgGA::EventQueue::Events::iterator itr = veitr->second.begin();
            itr != veitr->second.end();
            ++itr)
        {
            osgGA::Event* event = itr->get();
            for(View::EventHandlers::iterator hitr = view->getEventHandlers().begin();
                hitr != view->getEventHandlers().end();
                ++hitr)
            {
                (*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:


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;
#else




Regards,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68446#68446








More information about the osg-users mailing list