key input and keylistener for canvas