Skip to content

Commit bd9eba9

Browse files
committed
- Fixed Effect not suspended when instance is stopped (#1586)
- Fixed Background effect is started when instance is disabled
1 parent 4f2a1c1 commit bd9eba9

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7575
- Fixed Smoothing (#1863)
7676
- Fixed Crash when XCB,X11 was configured and display manager changed to Wayland
7777
- Fixed Target-directory not correctly build when exporting effects
78+
- Fixed Effect not suspended when instance is stopped (#1586)
79+
- Fixed Background effect is started when instance is disabled
7880

7981
**JSON-API**
8082
- Refactored JSON-API to ensure consistent authorization behaviour across sessions and single requests with token authorization.

include/hyperion/BGEffectHandler.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ private slots:
5252

5353
QJsonDocument _bgEffectConfig;
5454
bool _isBgEffectEnabled;
55-
56-
bool _isSuspended;
5755
};
5856

5957
#endif // BGEFFECTHANDLER_H

libsrc/effectengine/EffectEngine.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ EffectEngine::EffectEngine(Hyperion * hyperion)
4444
// get notifications about refreshed effect list
4545
connect(_effectFileHandler, &EffectFileHandler::effectListChanged, this, &EffectEngine::handleUpdatedEffectList);
4646

47+
// Stop all effects when instance is disabled, restart the same when enabled
48+
connect(_hyperion, &Hyperion::compStateChangeRequest, this, [=](hyperion::Components component, bool enable) {
49+
if (component == hyperion::COMP_ALL)
50+
{
51+
if (enable)
52+
{
53+
startCachedEffects();
54+
}
55+
else
56+
{
57+
cacheRunningEffects();
58+
stopAllEffects();
59+
}
60+
}
61+
});
62+
4763
// register smooth cfgs and fill available effects
4864
handleUpdatedEffectList();
4965
}

libsrc/hyperion/BGEffectHandler.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@ BGEffectHandler::BGEffectHandler(Hyperion* hyperion)
66
: QObject(hyperion)
77
, _hyperion(hyperion)
88
, _isBgEffectEnabled(false)
9-
, _isSuspended(false)
109
{
1110
QString subComponent = parent()->property("instance").toString();
1211
_log = Logger::getInstance("HYPERION", subComponent);
1312

1413
QObject::connect(_hyperion, &Hyperion::settingsChanged, this, &BGEffectHandler::handleSettingsUpdate);
1514
QObject::connect(_hyperion->getMuxerInstance().get(), &PriorityMuxer::prioritiesChanged, this, &BGEffectHandler::handlePriorityUpdate);
1615

17-
// listen for suspend/resume requests, to not start a background effect when system goes into suspend mode
18-
connect(_hyperion, &Hyperion::suspendRequest, this, [=] (bool isSuspended) {
19-
_isSuspended = isSuspended;
20-
});
21-
2216
// initialization
2317
handleSettingsUpdate(settings::BGEFFECT, _hyperion->getSetting(settings::BGEFFECT));
2418
}
@@ -90,9 +84,13 @@ void BGEffectHandler::handlePriorityUpdate(int currentPriority)
9084
Debug(_log,"Stop background (color-) effect as it moved out of scope");
9185
_hyperion->clear(PriorityMuxer::BG_PRIORITY);
9286
}
93-
else if (!_isSuspended && currentPriority == PriorityMuxer::LOWEST_PRIORITY && _isBgEffectEnabled)
87+
// Do not start a background effect when the overall instance is disabled
88+
else if (_hyperion->isComponentEnabled(hyperion::COMP_ALL))
9489
{
95-
Debug(_log,"Start background (color-) effect as it moved in scope");
96-
emit handleSettingsUpdate (settings::BGEFFECT, _bgEffectConfig);
90+
if (currentPriority == PriorityMuxer::LOWEST_PRIORITY && _isBgEffectEnabled)
91+
{
92+
Debug(_log, "Start background (color-) effect as it moved in scope");
93+
emit handleSettingsUpdate(settings::BGEFFECT, _bgEffectConfig);
94+
}
9795
}
9896
}

libsrc/hyperion/Hyperion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ int Hyperion::isComponentEnabled(hyperion::Components comp) const
361361
void Hyperion::setSuspend(bool isSuspend)
362362
{
363363
bool const enable = !isSuspend;
364-
emit compStateChangeRequestAll(enable);
364+
emit compStateChangeRequest(hyperion::COMP_ALL, enable);
365365
}
366366

367367
void Hyperion::setIdle(bool isIdle)

0 commit comments

Comments
 (0)