Fix up window repositioning/resizing code