On Mon, May 11, 2009 at 13:12, Fajran Iman Rusadi <[email protected]> wrote:
>
> After I investigated further, seems WindowManager tries to assign an
> _index to Window. This index should corresponds with the index in the
> Group's _children. The problem arises when I delete any Window but the
> last one, because the Window's _index is disrupted since I found no
> _index rearrangement (cmiiw).
>
I made a small patch for this problem. Hopefully it addresses the
problem correctly. At least in my case, the problem is gone.
--
Iang-
http://fajran.web.id y!m: fajran
diff --git a/src/osgWidget/WindowManager.cpp b/src/osgWidget/WindowManager.cpp
index 2fb9f4d..11df694 100644
--- a/src/osgWidget/WindowManager.cpp
+++ b/src/osgWidget/WindowManager.cpp
@@ -232,6 +232,11 @@ void WindowManager::childInserted(unsigned int i) {
if(!window) return;
+ // Update Window's index
+ for(Iterator w = begin(); w != end(); w++) {
+ if(w->get()->_index >= i) w->get()->_index++;
+ }
+
_objects.push_back(window);
window->_index = i;
@@ -261,6 +266,12 @@ void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) {
window->unmanaged(this);
}
}
+
+ // Update Window's index
+ for(Iterator w = begin(); w != end(); w++) {
+ if(w->get()->_index >= start) w->get()->_index -= numChildren;
+ }
+
}
// This method performs intersection testing at the given XY coords, and returns true if
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org