Skip to content

Commit 15c4935

Browse files
kkkzbhluisbocanegra
andcommitted
fix!: remove stale blur regions by id
BREAKING CHANGE: The C++ plugins needs to be rebuilt if it was installed manually from source, see https://github.com/luisbocanegra/plasma-panel-colorizer#build-from-source-with-c-plugin Co-authored-by: Luis Bocanegra <luisbocanegra@users.noreply.github.com>
1 parent 548eac0 commit 15c4935

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

package/contents/ui/components/CustomBackground.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ Rectangle {
389389

390390
Component.onDestruction: {
391391
if (main.panelColorizer) {
392-
main.panelColorizer.popLastVisibleMaskRegion();
392+
main.panelColorizer.removeMaskRegion(maskIndex);
393393
}
394394
main.recolorCountChanged.disconnect(recolorTimer.restart);
395395
main.updateMasks.disconnect(updateMaskDebounced);

plugin/panelcolorizer.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,11 @@ void PanelColorizer::combineRegions() {
8787

8888
bool PanelColorizer::hasRegions() const { return !m_mask.isEmpty(); }
8989

90-
void PanelColorizer::popLastVisibleMaskRegion() {
91-
if (!m_regions.isEmpty()) {
92-
int regionToRemove;
93-
for (int i = 0; i < m_regions.size(); i++) {
94-
if (m_regions.constFind(i)->second) {
95-
regionToRemove = i;
96-
}
97-
}
98-
m_regions.remove(regionToRemove);
90+
void PanelColorizer::removeMaskRegion(int index) {
91+
if (m_regions.remove(index) > 0) {
9992
combineRegions();
10093
}
101-
};
94+
}
10295

10396
QString PanelColorizer::getIconHash(const QVariant &variant) {
10497

plugin/panelcolorizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PanelColorizer : public QObject {
1919
Q_INVOKABLE void updatePanelMask(int index, QRectF rect, double topLeftRadius, double topRightRadius,
2020
double bottomLeftRadius, double bottomRightRadius, QPointF offset,
2121
int radiusCompensation, bool visible);
22-
Q_INVOKABLE void popLastVisibleMaskRegion();
22+
Q_INVOKABLE void removeMaskRegion(int index);
2323

2424
Q_INVOKABLE QString getIconHash(const QVariant &variant);
2525

0 commit comments

Comments
 (0)