Fixing infinite loop when some bad mouse movement are used to compute the display.