Fix coordinates tip flickering and incorrect coordinates calculation.

This fixes issues #5948 and $5949.