Manually cherry-pick popup dialog from upstream.

this originally came from fa1d499
Fix indent (to suit my preferred style)
Just hide the popup when a window resize occurs.

This just seems easier.