mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-29 03:05:05 +00:00
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:
2 files changed
+14
-3
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user