Dispatch input events accordingly