Change cursor.visible handling to work on Mac as well as elsewhere