x11: Handle window getting unmap while frame still pending
Since commit 972134ab we now call glClientWaitSync for the vendor nvidia driver, to know when a frame is ready for the compositor to process.
If a surface is hidden while a frame is still being processed, the surface will never produce the damage event the code relies on to trigger the call to glClientWaitSync. This leaves the fence dangling, and the next time the surface is shown, it will start a fresh frame and blow an assertion since the fence from the last frame is still hanging around.
This commit ensures a frame gets fully wrapped up before hiding a surface.
Fixes: #2902 (closed)