kcms/effects: Fix effect loading/unloading order
There are effects that are mutually exclusive, e.g. magnifier and zoom. They both use the same global shortcuts. When switching from zoom to magnifier, the zoom effect must be unloaded first, then the magnifier effect can be loaded. Doing so in the opposite order will break global shortcuts in the magnifier effect because zooming shortcuts are still bound by the zoom effect. BUG: 457800
This commit is contained in:
parent
ad4d615b23
commit
b0e452563b
1 changed files with 12 additions and 6 deletions
|
@ -536,12 +536,18 @@ void EffectsModel::save()
|
|||
return;
|
||||
}
|
||||
|
||||
for (const EffectData &effect : dirtyEffects) {
|
||||
if (effect.status != Status::Disabled) {
|
||||
interface.loadEffect(effect.serviceName);
|
||||
} else {
|
||||
interface.unloadEffect(effect.serviceName);
|
||||
}
|
||||
// Unload effects first, it's need to ensure that switching between mutually exclusive
|
||||
// effects works as expected, for example so global shortcuts are handed over, etc.
|
||||
auto split = std::partition(dirtyEffects.begin(), dirtyEffects.end(), [](const EffectData &data) {
|
||||
return data.status == Status::Disabled;
|
||||
});
|
||||
|
||||
for (auto it = dirtyEffects.begin(); it != split; ++it) {
|
||||
interface.unloadEffect(it->serviceName);
|
||||
}
|
||||
|
||||
for (auto it = split; it != dirtyEffects.end(); ++it) {
|
||||
interface.loadEffect(it->serviceName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue