Handle mouse visibility

A change to handle mouse visibility correctly.