Hi Simon,

I've run into that same issue with osgWidget.  I was removing a widget when
the user clicked on it, and osgWidget was trying to send a mouse up event to
the newly deleted widget.  I ended up just keeping the widgets around in a
higher level manager class so they would still exist, but I think using a
ref_ptr for _lastEvent in osgWidget would be a decent solution.

Thanks,

Jason

On Thu, Jul 2, 2009 at 4:17 AM, Simon Notheis <[email protected]> wrote:

> 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
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to