1
0
Fork 0

Canvas: Bugfixes

- Fix dependency cycle
 - Correctly forward mouse release event
This commit is contained in:
Thomas Geymayer 2012-08-13 13:59:45 +02:00
parent 303f491547
commit 875b59952b

View file

@ -90,7 +90,7 @@ class WindowUserData:
public osg::Referenced public osg::Referenced
{ {
public: public:
canvas::WindowPtr window; canvas::WindowWeakPtr window;
WindowUserData(canvas::WindowPtr window): WindowUserData(canvas::WindowPtr window):
window(window) window(window)
{} {}
@ -277,7 +277,8 @@ bool GUIMgr::handleMouse(const osgGA::GUIEventAdapter& ea)
{ {
assert(layer->getChild(j)->getUserData()); assert(layer->getChild(j)->getUserData());
canvas::WindowPtr window = canvas::WindowPtr window =
static_cast<WindowUserData*>(layer->getChild(j)->getUserData())->window; static_cast<WindowUserData*>(layer->getChild(j)->getUserData())
->window.lock();
if( window->getRegion().contains(event.x, event.y) ) if( window->getRegion().contains(event.x, event.y) )
{ {
window_at_cursor = window; window_at_cursor = window;
@ -300,9 +301,6 @@ bool GUIMgr::handleMouse(const osgGA::GUIEventAdapter& ea)
break; break;
case osgGA::GUIEventAdapter::RELEASE: case osgGA::GUIEventAdapter::RELEASE:
if( !_last_push.expired() )
return false;
target_window = _last_push.lock(); target_window = _last_push.lock();
_last_push.reset(); _last_push.reset();
break; break;