Generally I expect the child window of modal window can propogate the keyboard events( key down, up and char) to the modal window itself.
So I can handle all unhandled keyboard events using the modal window's onKeyXXXX like functions.
But the code in CEGUIWindow.cpp seems to prevent this. And I only can archeive this by subscribe handlers to all the child windows of the modal window.....
Code: Select all
void Window::onKeyDown(KeyEventArgs& e)
{
fireEvent(EventKeyDown, e, EventNamespace);
// As of 0.7.0 CEGUI::System no longer does input event propogation, so by
// default we now do that here. Generally speaking key handling widgets
// may need to override this behaviour to halt further propogation.
if (!e.handled && d_parent &&
d_parent != System::getSingleton().getModalTarget())
{
e.window = d_parent;
d_parent->onKeyDown(e);
}
}
This line:
Code: Select all
if (!e.handled && d_parent &&
d_parent != System::getSingleton().getModalTarget())
Stops propogating the event to its parent if it is a child window of the modal window.
According to the comments, I'm wondering whether the code should be:
Code: Select all
if (!e.handled && d_parent &&
this != System::getSingleton().getModalTarget())
To stop propogating right at the modal window.