InputListener: handle hardware key events

thanks @fython , but I'm not sure if it is working correctly