Handling reshaping of the window