Skip to content

Commit

Permalink
QNX: Ensure invisible 1x1 raster windows are posted.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Roger Maclean authored and jmcdonnell-qnx committed Jul 6, 2016
1 parent 1575f2f commit abc2908
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/plugins/platforms/qnx/qqnxrasterwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/platforms/qnx/qqnxwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit abc2908

Please sign in to comment.