[windowthumbnails] Guard against software QtQuick backend
If we are using the software renderer QQuickWindow::createTextureFromNativeObject returns null. We already checking for kwin using GL compositing so we can expand to check QtQuick's usage.
This commit is contained in:
parent
1a87e9c9ac
commit
50b4e988a4
2 changed files with 9 additions and 2 deletions
|
@ -164,11 +164,17 @@ void WindowThumbnailItem::updateFrameRenderingConnection()
|
|||
return;
|
||||
}
|
||||
|
||||
if (Compositor::self()->backend()->compositingType() == OpenGLCompositing) {
|
||||
if (useGlThumbnails()) {
|
||||
m_frameRenderingConnection = connect(Compositor::self()->scene(), &Scene::preFrameRender, this, &WindowThumbnailItem::updateOffscreenTexture);
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowThumbnailItem::useGlThumbnails()
|
||||
{
|
||||
static bool qtQuickIsSoftware = QStringList({QStringLiteral("software"), QStringLiteral("softwarecontext")}).contains(QQuickWindow::sceneGraphBackend());
|
||||
return Compositor::self()->backend()->compositingType() == OpenGLCompositing && !qtQuickIsSoftware;
|
||||
}
|
||||
|
||||
QSize WindowThumbnailItem::sourceSize() const
|
||||
{
|
||||
return m_sourceSize;
|
||||
|
@ -188,7 +194,7 @@ void WindowThumbnailItem::destroyOffscreenTexture()
|
|||
if (!Compositor::compositing()) {
|
||||
return;
|
||||
}
|
||||
if (Compositor::self()->backend()->compositingType() != OpenGLCompositing) {
|
||||
if (!useGlThumbnails()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ private:
|
|||
void destroyOffscreenTexture();
|
||||
void updateImplicitSize();
|
||||
void updateFrameRenderingConnection();
|
||||
static bool useGlThumbnails();
|
||||
|
||||
QSize m_sourceSize;
|
||||
QUuid m_wId;
|
||||
|
|
Loading…
Reference in a new issue