Flush the reparent from 0c7dbe8

This should add a root reparent to prevent that X11 error, but it should
still prevent flickering by doing it just before closing the window.
This commit is contained in:
Robbert van der Helm
2021-04-27 03:43:45 +02:00
parent 0d1d368e4f
commit 5a68b8b39d
+7 -1
View File
@@ -147,12 +147,18 @@ DeferredWindow::~DeferredWindow() {
// Note that we capture a copy of `destroy_timer` here. This way we don't
// have to manage the timer instance ourselves as it will just clean itself
// up after this lambda gets called.
destroy_timer->async_wait([destroy_timer, handle = this->handle](
destroy_timer->async_wait([destroy_timer, handle = this->handle,
x11_connection = this->x11_connection](
const boost::system::error_code& error) {
if (error.failed()) {
return;
}
// This is the flush for the reparent done above. We'll also do this as
// late as possible to prevent the window from being drawn in the
// meantime, as that would cause flickering.
xcb_flush(x11_connection.get());
// The actual destroying will happen as part of the Win32 message loop
PostMessage(handle, WM_CLOSE, 0, 0);
});