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