Simplify some mouse event switching logic.