Reorganise handling of WM_SIZE to fix two generality problems.