Just pushed the improved UI event handling to github. This should fix the
segfaults during conversations in with the NPC in worldtest. The main reason
for those was that in a callback, the widget that triggered the callback got
deleted.

The big change is that widgets just fire events, but the window_manager is
the one triggering the callbacks registered for those events. As an added
benefit, multiple callbacks can now be attached to the same event of the
same widget.

In order to make stuff simple to use, I've added methods that return the
exact event required to register a callback for a certain action of a
widget. I also added shortcuts to the event factory that take the event to
register for and the callback and hide the listener that's created
internally.


I have also changed the ownership of windows passed to the window_manager.
These are now deleted by the window_manager. As with the event handling,
window deletion is deferred until the next frame (or until the window has
faded out completely), so it is safe to call window_manager::remove from
within the window itself.


There's a bit of an issue with the python wrappers, however. I tried to make
sure that the wrapper for window_manager::add takes ownership of the window
away from Python. I thought I had this working elsewhere, but wasn't able to
apply this to window_manager. Might have to ask on the SWIG mailing list to
find a solution. So for now, one has to manually set thisown = 0 after
adding a window to the window_manager.

Kai
_______________________________________________
Adonthell-devel mailing list
Adonthell-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/adonthell-devel

Reply via email to