First pass at keyboard and mouse events. They work, but probably still have bugs.

Are you sure about this? intParam4 is changing to intParam3 here?