From de8bd8f12664f054165d64d18e8b3febfa71d4d9 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 10 Jul 2024 18:17:39 +0200 Subject: [PATCH] plugins/fadingpopups: don't block direct scanout The effect only modifies the opacity of individual windows that WorkspaceScene::scanoutCandidate will reject anyways, so there's no reason for it to block direct scanout. Once a more proper solution for blocking direct scanout on individual items is in place, this can be removed again BUG: 487780 --- autotests/integration/dont_crash_cancel_animation.cpp | 2 +- src/plugins/fadingpopups/package/metadata.json | 1 + src/scripting/scriptedeffect.cpp | 10 ++++++++-- src/scripting/scriptedeffect.h | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/autotests/integration/dont_crash_cancel_animation.cpp b/autotests/integration/dont_crash_cancel_animation.cpp index 55dc6b85ff..53cdae3be1 100644 --- a/autotests/integration/dont_crash_cancel_animation.cpp +++ b/autotests/integration/dont_crash_cancel_animation.cpp @@ -71,7 +71,7 @@ void DontCrashCancelAnimationFromAnimationEndedTest::cleanup() void DontCrashCancelAnimationFromAnimationEndedTest::testScript() { // load a scripted effect which deletes animation data - ScriptedEffect *effect = ScriptedEffect::create(QStringLiteral("crashy"), QFINDTESTDATA("data/anim-data-delete-effect/effect.js"), 10, QString()); + ScriptedEffect *effect = ScriptedEffect::create(QStringLiteral("crashy"), QFINDTESTDATA("data/anim-data-delete-effect/effect.js"), 10, QString(), true); QVERIFY(effect); const auto children = effects->children(); diff --git a/src/plugins/fadingpopups/package/metadata.json b/src/plugins/fadingpopups/package/metadata.json index 7de418e5ec..bf13d6dce6 100644 --- a/src/plugins/fadingpopups/package/metadata.json +++ b/src/plugins/fadingpopups/package/metadata.json @@ -103,5 +103,6 @@ "Name[zh_TW]": "淡化彈出視窗" }, "X-KDE-Ordering": 60, + "X-KDE-BlocksDirectScanout": false, "X-Plasma-API": "javascript" } diff --git a/src/scripting/scriptedeffect.cpp b/src/scripting/scriptedeffect.cpp index 337a1f9974..3e3694603f 100644 --- a/src/scripting/scriptedeffect.cpp +++ b/src/scripting/scriptedeffect.cpp @@ -165,10 +165,10 @@ ScriptedEffect *ScriptedEffect::create(const KPluginMetaData &effect) return nullptr; } - return ScriptedEffect::create(name, scriptFile, effect.value(QStringLiteral("X-KDE-Ordering"), 0), effect.value(QStringLiteral("X-KWin-Exclusive-Category"))); + return ScriptedEffect::create(name, scriptFile, effect.value(QStringLiteral("X-KDE-Ordering"), 0), effect.value(QStringLiteral("X-KWin-Exclusive-Category")), effect.value(QStringLiteral("X-KDE-BlocksDirectScanout"), true)); } -ScriptedEffect *ScriptedEffect::create(const QString &effectName, const QString &pathToScript, int chainPosition, const QString &exclusiveCategory) +ScriptedEffect *ScriptedEffect::create(const QString &effectName, const QString &pathToScript, int chainPosition, const QString &exclusiveCategory, bool blocksDirectScanout) { ScriptedEffect *effect = new ScriptedEffect(); effect->m_exclusiveCategory = exclusiveCategory; @@ -177,6 +177,7 @@ ScriptedEffect *ScriptedEffect::create(const QString &effectName, const QString return nullptr; } effect->m_chainPosition = chainPosition; + effect->m_blocksDirectScanout = blocksDirectScanout; return effect; } @@ -306,6 +307,11 @@ bool ScriptedEffect::isActiveFullScreenEffect() const return effects->activeFullScreenEffect() == this; } +bool ScriptedEffect::blocksDirectScanout() const +{ + return m_blocksDirectScanout; +} + QList ScriptedEffect::touchEdgesForAction(const QString &action) const { QList ret; diff --git a/src/scripting/scriptedeffect.h b/src/scripting/scriptedeffect.h index 8ef3157976..fab32aee8e 100644 --- a/src/scripting/scriptedeffect.h +++ b/src/scripting/scriptedeffect.h @@ -80,7 +80,7 @@ public: } QString activeConfig() const; void setActiveConfig(const QString &name); - static ScriptedEffect *create(const QString &effectName, const QString &pathToScript, int chainPosition, const QString &exclusiveCategory); + static ScriptedEffect *create(const QString &effectName, const QString &pathToScript, int chainPosition, const QString &exclusiveCategory, bool blocksDirectScanout); static ScriptedEffect *create(const KPluginMetaData &effect); static bool supported(); ~ScriptedEffect() override; @@ -182,6 +182,7 @@ public: QString pluginId() const; bool isActiveFullScreenEffect() const; + bool blocksDirectScanout() const override; public Q_SLOTS: bool borderActivated(ElectricBorder border) override; @@ -222,5 +223,6 @@ private: Effect *m_activeFullScreenEffect = nullptr; std::map> m_shaders; uint m_nextShaderId{1u}; + bool m_blocksDirectScanout = true; }; }