QNX: Ensure invisible 1x1 raster windows are posted.

Non-top level raster windows still have screen windows associated
with them though they are not intended to be visible.

This causes problems if they have children (as they do when QGLWidgets
are used) since their children will also not be visible.

So, if we have a window with a parent, force them to post but set the
transparency to discard so they remain invisible.

This allows the example hellogl_es2 to run correctly.

Change-Id: I67e24dc59b29ce789376498c2477349fa50020e1
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This commit is contained in:
Roger Maclean 2014-10-29 11:06:20 -04:00 committed by James McDonnell
parent 1575f2fc3c
commit abc29084fa
2 changed files with 14 additions and 2 deletions

View File

@ -172,7 +172,7 @@ 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(1,1) : window()->size();
const QSize windowSize = window()->parent() ? QSize(0,0) : window()->size();
if (windowSize != bufferSize())
setBufferSize(windowSize);
}
@ -188,6 +188,13 @@ 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)

View File

@ -386,7 +386,12 @@ void QQnxWindow::setBufferSize(const QSize &size)
// Set the transparency. According to QNX technical support, setting the window
// transparency property should always be done *after* creating the window
// buffers in order to guarantee the property is paid attention to.
if (window()->requestedFormat().alphaBufferSize() == 0) {
if (size.isEmpty()) {
// We can't create 0x0 buffers and instead make them 1x1. But to allow these windows to
// still be 'visible' (thus allowing their children to be visible), we need to allow
// them to be posted but still not show up.
val[0] = SCREEN_TRANSPARENCY_DISCARD;
} else if (window()->requestedFormat().alphaBufferSize() == 0) {
// To avoid overhead in the composition manager, disable blending
// when the underlying window buffer doesn't have an alpha channel.
val[0] = SCREEN_TRANSPARENCY_NONE;