handle resize mode of the window