ivansafrin/Polycode — pull request #153 by mcclure (2013-02-17 20:47:38+00:00)
Title: Give some way to recover from CoreInput::removeAllHandlers()

The core->getInput() object has a method removeAllHandlers(). When my "player" implementation is unloading a Lua program, it calls removeAllHandlers() to make TOTALLY CERTAIN nothing survives from the run of one program to the next (as this could cause a crash).

However this creates a problem. CoreServices, on setting the core, wires up many input handlers for the Screen Manager, meaning any call to CoreInput's removeAllHandlers effectively permanently breaks Polycore. Although any user would surely realize removeAllHandlers is a "dangerous" operation, it still seems like something an informed user should be able to do while still leaving Polycode functional.

I don't know what the best solution here is, but what I settled on was adding a setupBasicHandlers() method on CoreServices which resets the current (and future?) CoreServices-owned event handlers, thus meaning a clued-in user can make the destructive removeAllHandlers() call and then be able to get back to a working state.

Yeah, this writeup is totally several times longer than the actual patch