From Sergey Leontyev, "Some minor(but important) bug fixes for osgWidget:

1. In WindowManager.cpp childRemoved method the second parameter "end" is misleading and

should be named "numChildren" instead. It represents how many children to remove.  As a result, the method was implemented incorrectly and failed to remove UI objects. So I fixed it.

 

replaced this:

 

void WindowManager::childRemoved(unsigned int start, unsigned int end) {
    while(start < end) {
        Window* window = getByIndex(start);

        if(!window) continue;

        if(_remove(window)) {
            window->_index = -1;

            window->unmanaged(this);
        }

        start++;
    }
}

 

with this:

void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) {
 for (unsigned int i = start; i < start+numChildren; i++)
 {
  Window* window = getByIndex(i);

  if(!window) continue;

  if(_remove(window)) {
   window->_index = -1;

   window->unmanaged(this);
  }
 }
}

 

2. in Input.cpp

 

The cursor in Input did not get positioned correctly, probably as a left over from the TOP LEFT origin system which is now BOTTOM LEFT.

in method positioned()

replaced this:

    _cursor->setOrigin(x + xoffset + 1.0f, y - _cursor->getHeight() + 1.0f);

 

with this:

    _cursor->setOrigin(x + xoffset + 1.0f, y + 1.0f);

 

Now it is placed correctly.

 "
This commit is contained in:
Robert Osfield 2009-01-06 16:16:03 +00:00
parent 5a6a3f1edd
commit ec457e34c3
2 changed files with 5 additions and 6 deletions

View File

@ -113,7 +113,7 @@ void Input::positioned() {
point_type xoffset = _index > 0 ? _offsets[_index - 1] : 0.0f; point_type xoffset = _index > 0 ? _offsets[_index - 1] : 0.0f;
_cursor->setOrigin(x + xoffset + 1.0f, y - _cursor->getHeight() + 1.0f); _cursor->setOrigin(x + xoffset + 1.0f, y + 1.0f);
_cursor->setZ(_calculateZ(LAYER_MIDDLE)); _cursor->setZ(_calculateZ(LAYER_MIDDLE));
} }

View File

@ -248,9 +248,10 @@ void WindowManager::childInserted(unsigned int i) {
_styleManager->applyStyles(window); _styleManager->applyStyles(window);
} }
void WindowManager::childRemoved(unsigned int start, unsigned int end) { void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) {
while(start < end) { for (unsigned int i = start; i < start+numChildren; i++)
Window* window = getByIndex(start); {
Window* window = getByIndex(i);
if(!window) continue; if(!window) continue;
@ -259,8 +260,6 @@ void WindowManager::childRemoved(unsigned int start, unsigned int end) {
window->unmanaged(this); window->unmanaged(this);
} }
start++;
} }
} }