forked from quickshell/quickshell
fix: remove unexpected and undefined mask behavior
ProxyWindowBase no longer takes ownership of the mask. It is no longer undefined behavior to set the mask to null.
This commit is contained in:
parent
e1bb5dfd3b
commit
3d4b8efc74
2 changed files with 14 additions and 3 deletions
|
@ -172,22 +172,32 @@ void ProxyWindowBase::setColor(QColor color) {
|
|||
PendingRegion* ProxyWindowBase::mask() const { return this->mMask; }
|
||||
|
||||
void ProxyWindowBase::setMask(PendingRegion* mask) {
|
||||
if (mask == this->mMask) return;
|
||||
|
||||
if (this->mMask != nullptr) {
|
||||
this->mMask->deleteLater();
|
||||
QObject::disconnect(this->mMask, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
this->mMask = mask;
|
||||
|
||||
if (mask != nullptr) {
|
||||
mask->setParent(this);
|
||||
this->mMask = mask;
|
||||
QObject::connect(mask, &QObject::destroyed, this, &ProxyWindowBase::onMaskDestroyed);
|
||||
QObject::connect(mask, &PendingRegion::changed, this, &ProxyWindowBase::maskChanged);
|
||||
emit this->maskChanged();
|
||||
}
|
||||
|
||||
emit this->maskChanged();
|
||||
}
|
||||
|
||||
void ProxyWindowBase::onMaskChanged() {
|
||||
if (this->window != nullptr) this->updateMask();
|
||||
}
|
||||
|
||||
void ProxyWindowBase::onMaskDestroyed() {
|
||||
this->mMask = nullptr;
|
||||
emit this->maskChanged();
|
||||
}
|
||||
|
||||
void ProxyWindowBase::updateMask() {
|
||||
QRegion mask;
|
||||
if (this->mMask != nullptr) {
|
||||
|
|
|
@ -97,6 +97,7 @@ protected slots:
|
|||
virtual void onWidthChanged();
|
||||
virtual void onHeightChanged();
|
||||
void onMaskChanged();
|
||||
void onMaskDestroyed();
|
||||
void onScreenDestroyed();
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue