diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2023-06-23 19:06:53 +0200 |
---|---|---|
committer | Artem Dyomin <artem.dyomin@qt.io> | 2023-06-26 14:03:41 +0200 |
commit | ba64456c344021ba9352c7bb237556d90bd9f8f4 (patch) | |
tree | dfab92afe9f3971d288f71561b2308b444b19b34 /src/multimedia/platform | |
parent | 3edff8e367b9060dd138a2b67cb87d2246a4a3e6 (diff) |
Fix surface source setup
This is the addition to the patch with refactoring of
the initial screen and window capture design.
Pick-to: 6.6 6.5
Change-Id: I8694027bf2f6dff962b75fe1aee30fdcf45e2bf8
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'src/multimedia/platform')
-rw-r--r-- | src/multimedia/platform/qplatformsurfacecapture.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/multimedia/platform/qplatformsurfacecapture.cpp b/src/multimedia/platform/qplatformsurfacecapture.cpp index 66bda4ce6..89adf3715 100644 --- a/src/multimedia/platform/qplatformsurfacecapture.cpp +++ b/src/multimedia/platform/qplatformsurfacecapture.cpp @@ -19,10 +19,8 @@ void QPlatformSurfaceCapture::setActive(bool active) if (m_active == active) return; - if (!setActiveInternal(active)) { - qWarning() << "Failed to change active status to value" << active; + if (!setActiveInternal(active)) return; - } m_active = active; emit activeChanged(active); @@ -37,8 +35,20 @@ void QPlatformSurfaceCapture::setSource(Source source) { Q_ASSERT(source.index() == m_source.index()); - if (std::exchange(m_source, source) != source) - std::visit([this](auto source) { emit sourceChanged(source); }, m_source); + if (m_source == source) + return; + + if (m_active) + setActiveInternal(false); + + m_source = source; + + if (m_active && !setActiveInternal(true)) { + m_active = false; + emit activeChanged(false); + } + + std::visit([this](auto source) { emit sourceChanged(source); }, m_source); } QPlatformSurfaceCapture::Error QPlatformSurfaceCapture::error() const |