mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:31:16 -07:00
Fallback to another plugin if preferred one doesn't work
I assume this is what the code wants to do instead of looping through all the plugins just to find a specific one and just giving up it it fails.
This commit is contained in:
@@ -76,17 +76,21 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVaria
|
||||
}
|
||||
}
|
||||
|
||||
if (auto preferredPlugin = m_plugins[ KrfbConfig::preferredFrameBufferPlugin() ]) {
|
||||
if (auto frameBuffer = QSharedPointer<FrameBuffer>(preferredPlugin->frameBuffer(args))) {
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
|
||||
return frameBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't already have that frame buffer.
|
||||
for (auto it = m_plugins.cbegin(); it != m_plugins.constEnd(); it++) {
|
||||
if (it.key() == KrfbConfig::preferredFrameBufferPlugin()) {
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
|
||||
QSharedPointer<FrameBuffer> frameBuffer(it.value()->frameBuffer(args));
|
||||
if (frameBuffer) {
|
||||
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
|
||||
|
||||
return frameBuffer;
|
||||
}
|
||||
QSharedPointer<FrameBuffer> frameBuffer(it.value()->frameBuffer(args));
|
||||
if (frameBuffer) {
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << it.key();
|
||||
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
|
||||
return frameBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user