Fix window coordinate calculation bug that is asymptomatic on Linux but causes crashing on Windows.