I also don't see how ShowWindow() is supposed to make sure WM_SIZE is processed? Why not flush_events() instead?
There's a flush_events() a few lines later already, but it's not enough to ensure that this WM_SIZE has been received.
It's not clear why we get an extra WM_SIZE at that point. Anyway I've dropped the change for now since it's not part of the d3d8 backport.