diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-11-30 11:31:43 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-12-01 12:44:34 +0000 |
commit | 5d63e325faa44cf1345d6f7b5cb39ec874527675 (patch) | |
tree | 8f6c4b8cfad5ac8720773624cff63930e915a78b /src | |
parent | b0ec05f27bff6065c97e6e4a0f1606da7472d18c (diff) |
Avoid dynamic switching between backingstore composition paths
Make it opt-in because doing a normal backingstore flush does not seem to
work on Cocoa once we use OpenGL on the window. Windows and Linux should
be able to cope with this.
This means that platforms outside Windows and Linux will continue to have
the problem of having GL-based compositing enabled for ever after having a
QOpenGL/QuickWidget shown in the window once, but the issue is most
prevalent on Windows anyway, OS X machines can deal with OpenGL better
in general.
Task-number: QTBUG-49172
Change-Id: I30fd2efa95cc4f6eed9cf7f7613d0750355c775c
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsintegration.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 17 |
4 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 00c50a9861..af89a73455 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -91,7 +91,8 @@ public: SyncState, RasterGLSurface, AllGLFunctionsQueryable, - ApplicationIcon + ApplicationIcon, + SwitchableWidgetComposition }; virtual ~QPlatformIntegration() { } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 6b50ebe8a1..55e6d55e5b 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -282,6 +282,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case AllGLFunctionsQueryable: return true; + case SwitchableWidgetComposition: + return true; default: return QPlatformIntegration::hasCapability(cap); } diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 9cedfa77ad..19e8b1de7d 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -252,6 +252,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const case ForeignWindows: return true; case SyncState: return true; case RasterGLSurface: return true; + case SwitchableWidgetComposition: return true; default: return QPlatformIntegration::hasCapability(cap); } } diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 6d43adc33b..b86c376385 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -104,7 +104,6 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBack #ifndef QT_NO_OPENGL if (widgetTextures) { - Q_ASSERT(!widgetTextures->isEmpty()); qt_window_private(tlw->windowHandle())->compositing = true; widget->window()->d_func()->sendComposeStatus(widget->window(), false); // A window may have alpha even when the app did not request @@ -955,6 +954,8 @@ static void findAllTextureWidgetsRecursively(QWidget *tlw, QWidget *widget) } } +Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList) + static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) { foreach (QPlatformTextureList *tl, QWidgetPrivate::get(tlw)->topData()->widgetTextures) { @@ -965,6 +966,20 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) return tl; } } + + if (QWidgetPrivate::get(tlw)->textureChildSeen) { + // No render-to-texture widgets in the (sub-)tree due to hidden or native + // children. Returning null results in using the normal backingstore flush path + // without OpenGL-based compositing. This is very desirable normally. However, + // some platforms cannot handle switching between the non-GL and GL paths for + // their windows so it has to be opt-in. + static bool switchableWidgetComposition = + QGuiApplicationPrivate::instance()->platformIntegration() + ->hasCapability(QPlatformIntegration::SwitchableWidgetComposition); + if (!switchableWidgetComposition) + return qt_dummy_platformTextureList(); + } + return 0; } |