ivansafrin/Polycode — pull request #157 by mcclure (2013-03-04 01:25:05+00:00)
Title: Prevent event-code collisions when using Polycode stock classes

...by adding a class-unique EVENTBASE_ constant to each class's event types. (The EVENTBASE_s are documented in PolyEvent.h.) Also make a small change to create_lua_library to support the EVENTBASE_ idiom.

Right now you can get these collisions by doing VERY basic tasks in the UI library, for example making a window and attaching a handler to CLOSE_EVENT will trigger on a non-UIEvent event if you click *anywhere* in the window. The only way to avoid this currently is to do a string comparison in every event handler to double-check, which is not user friendly. Although collisions are in principle not possible to prevent completely, it is at least possible to ensure collisions never happen when using classes that ship with Polycode so we should do that.