diff --git a/src/plugins/platforms/mirclient/window.cpp b/src/plugins/platforms/mirclient/window.cpp index 812b71e6928c2250517f1db0f6df66fd98c34704..dd37d78948fe57dc973c0b4bc980b3f9291818e9 100644 --- a/src/plugins/platforms/mirclient/window.cpp +++ b/src/plugins/platforms/mirclient/window.cpp @@ -98,7 +98,6 @@ public: MirConnection *connection; MirSurface* surface; QSize bufferSize; - QSize targetBufferSize; QMutex mutex; QSharedPointer<UbuntuClipboard> clipboard; }; @@ -318,17 +317,15 @@ void UbuntuWindow::handleSurfaceResize(int width, int height) LOG("UbuntuWindow::handleSurfaceResize(width=%d, height=%d)", width, height); // The current buffer size hasn't actually changed. so just render on it and swap - // buffers until we render on a buffer with the target size. - - d->targetBufferSize.rwidth() = width; - d->targetBufferSize.rheight() = height; - - if (d->bufferSize != d->targetBufferSize) { + // buffers in the hope that the next buffer will match the surface size advertised + // in this event. + // But since this event is processed by a thread different from the one that swaps + // buffers, you can never know if this information is already outdated as there's + // no synchronicity whatsoever between the processing of resize events and the + // consumption of buffers. + if (d->bufferSize.width() != width || d->bufferSize.height() != height) { QWindowSystemInterface::handleExposeEvent(window(), geometry()); - } else { - qWarning("[ubuntumirclient QPA] UbuntuWindow::handleSurfaceResize" - " current buffer already has the target size"); - d->targetBufferSize = QSize(); + QWindowSystemInterface::flushWindowSystemEvents(); } } @@ -430,20 +427,5 @@ void UbuntuWindow::onBuffersSwapped_threadSafe(int newBufferWidth, int newBuffer QPlatformWindow::setGeometry(newGeometry); QWindowSystemInterface::handleGeometryChange(window(), newGeometry, QRect()); - QWindowSystemInterface::handleExposeEvent(window(), newGeometry); - - } else { - // buffer size hasn't changed - if (d->targetBufferSize.isValid()) { - if (d->bufferSize != d->targetBufferSize) { - // but we still didn't reach the promised buffer size from the mir resize event. - // thus keep swapping buffers - QWindowSystemInterface::handleExposeEvent(window(), geometry()); - } else { - // target met. we have just provided a render with the target size and - // can therefore finally rest. - d->targetBufferSize = QSize(); - } - } } }