Problem: Autocmd callbacks currently have to rely on curwin, which may
already have changed by the time they run. This is especially noticeable
for WinNew, WinClosed, WinResized and WinScrolled.
Solution: Track the window in the autocmd context and expose it as ev.win.
Pass it explicitly for the window events that need it.