Use MOUSE_LEAVE event to fix middle and right click bug (fixes #422)