Moved more event handling over to libfoundation.