client: Flush painting on subsurfaces
When native widgets are nested in Qt, they act like independent windows with a shared backing store. The toplevel window gets multiple flush events with an argument for the window sub-content. In wayland we need a unique backing store, so this code copies the relevant contents into a new buffer and attaches it to the subsurface. Task-number: QTBUG-128029 Pick-to: 6.8 Change-Id: I865cb271d694d8190a444eb5a98378cd6a30634d Reviewed-by: David Redondo <qt@david-redondo.de>
This commit is contained in:
parent
193b7f011f
commit
2d5c66b79c
@ -208,16 +208,23 @@ void QWaylandShmBackingStore::endPaint()
|
|||||||
|
|
||||||
void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
|
void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(offset)
|
||||||
// Invoked when the window is of type RasterSurface or when the window is
|
// Invoked when the window is of type RasterSurface or when the window is
|
||||||
// RasterGLSurface and there are no child widgets requiring OpenGL composition.
|
// RasterGLSurface and there are no child widgets requiring OpenGL composition.
|
||||||
|
|
||||||
// For the case of RasterGLSurface + having to compose, the composeAndFlush() is
|
// For the case of RasterGLSurface + having to compose, the composeAndFlush() is
|
||||||
// called instead. The default implementation from QPlatformBackingStore is sufficient
|
// called instead. The default implementation from QPlatformBackingStore is sufficient
|
||||||
// however so no need to reimplement that.
|
// however so no need to reimplement that.
|
||||||
|
if (window != this->window()) {
|
||||||
|
auto waylandWindow = static_cast<QWaylandWindow *>(window->handle());
|
||||||
Q_UNUSED(window);
|
auto newBuffer = new QWaylandShmBuffer(mDisplay, window->size(), mBackBuffer->image()->format(), mBackBuffer->scale());
|
||||||
Q_UNUSED(offset);
|
newBuffer->setDeleteOnRelease(true);
|
||||||
|
QRect sourceRect(window->position(), window->size());
|
||||||
|
QPainter painter(newBuffer->image());
|
||||||
|
painter.drawImage(QPoint(0, 0), *mBackBuffer->image(), sourceRect);
|
||||||
|
waylandWindow->safeCommit(newBuffer, region);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mPainting) {
|
if (mPainting) {
|
||||||
mPendingRegion |= region;
|
mPendingRegion |= region;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user