From d15ef5bc3ae4df5ddc374d4bc8fee736868f1628 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 17 Mar 2022 17:57:14 +1000 Subject: 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 --- src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp | 16 +++++----------- src/plugins/platforms/qnx/qqnxrasterwindow.cpp | 12 ++---------- 2 files changed, 7 insertions(+), 21 deletions(-) (limited to 'src/plugins/platforms/qnx') diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index fe68927fda..95b8fb26e3 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -89,17 +89,11 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const if (!m_needsPosting) return; - QQnxWindow *targetWindow = nullptr; - if (window) - targetWindow = static_cast(window->handle()); - - // 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 + auto *targetWindow = window + ? static_cast(window->handle()) : platformWindow(); + + if (targetWindow) + targetWindow->post(region); // update the display with newly rendered content m_needsPosting = false; m_scrolled = false; diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index 0014ef8c6e..c91286217e 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -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 ®ion, int dx, int dy, bool flush) -- cgit v1.2.3