QNX: always create buffers for child windows

The QNX raster backend worked on the assumption that child windows were
sharing their parent toplevel window buffer instead, and thus did not
have a buffer of their own. This piece of code dates back from the
BlackBerry days, and I am guessing the motivation was to tackle
mmrenderer/foreign windows.

In fact, not having buffers causes QWindow to malfunction, as
independent buffers are required.

This patch makes sure every QQnxWindow has a backing buffer, as
expected. Foreign widnows shall be dealt with via different means.

Change-Id: I059ac4f8ac684b3577048f874f82b866f21326b1
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
This commit is contained in:
Rafael Roquetto 2022-03-17 17:57:14 +10:00
parent 9d12f6adbc
commit d15ef5bc3a
2 changed files with 6 additions and 20 deletions

View File

@ -89,17 +89,11 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
if (!m_needsPosting)
return;
QQnxWindow *targetWindow = nullptr;
if (window)
targetWindow = static_cast<QQnxWindow *>(window->handle());
auto *targetWindow = window
? static_cast<QQnxRasterWindow *>(window->handle()) : platformWindow();
// we only need to flush the platformWindow backing store, since this is
// the buffer where all drawing operations of all windows, including the
// child windows, are performed; conceptually ,child windows have no buffers
// (actually they do have a 1x1 placeholder buffer due to libscreen limitations),
// since Qt will only draw to the backing store of the top-level window.
if (!targetWindow || targetWindow == platformWindow())
platformWindow()->post(region); // update the display with newly rendered content
if (targetWindow)
targetWindow->post(region); // update the display with newly rendered content
m_needsPosting = false;
m_scrolled = false;

View File

@ -177,9 +177,8 @@ void QQnxRasterWindow::setParent(const QPlatformWindow *wnd)
void QQnxRasterWindow::adjustBufferSize()
{
// When having a raster window we don't need any buffers, since
// Qt will draw to the parent TLW backing store.
const QSize windowSize = window()->parent() ? QSize(0,0) : window()->size();
const QSize windowSize = window()->size();
if (windowSize != bufferSize())
setBufferSize(windowSize);
}
@ -195,13 +194,6 @@ void QQnxRasterWindow::resetBuffers()
m_currentBufferIndex = -1;
m_previousDirty = QRegion();
m_scrolled = QRegion();
if (window()->parent() && bufferSize() == QSize(1,1)) {
// If we have a parent then we're not really rendering. But if we don't render we'll
// be invisible and any children won't show up. This should be harmless since we're
// rendering into a 1x1 window that has transparency set to discard.
renderBuffer();
post(QRegion(0,0,1,1));
}
}
void QQnxRasterWindow::blitPreviousToCurrent(const QRegion &region, int dx, int dy, bool flush)