Added precision in the test of window position
Changed adapt size function to use test of window position with precision