[osg-users] osgWidget::WindowManager::_lastEvent suggestion
Simon Notheis
notheis at ira.uka.de
Thu Jul 2 01:17:06 PDT 2009
Hi Robert,
sorry for my late reply, but your posting didn't make it to the gmane newsgroup which I am using. So I'll give the forum a try :-)
I didn't modify the OSG code because we're using various installations here (windows and linux). The WindowManager has a memeber
EventInterface* _lastEvent which tracks the last EventInterface (i.e. Widget) that received a mouse event (ENTER, PUSH, ....).
If a new mouse event is received, the WindowManager checks if he should send a mouse LEAVE event to the widget stored in _lastEvent.
What I do, is that I initially focus the widgets/menus via mouse, but then use keyboard interaction to select items and that interaction my replace all widgets in the menu list by new ones. So when I after that move the mouse again, WindowManager tries to send a mouse LEAVE to _lastEvent which at that mpoint may be an invalid pointer.
So my idea was to just use osg::ref_ptr<EventInterface> _lastEvent instead and do some additional _lastEvent.valid() checks. But since I'm not too familiar with the internals of the WindowManager I don't know exactly what implications this would have.
In our own code, we are just forwarding the WindowManagers mouse and keyboard event to our own listener classes, so I just added a ref_ptr there, so that I have a "backup" of the original widget that is stored in WindowManager::_lastEvent so that the WM can call whatever function he wants.
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=14805#14805
More information about the osg-users
mailing list