core/window: fix mask reactivity

Masks previously would not update if the item was changed, and full
transparency was decided incorrectly.
This commit is contained in:
outfoxxed 2024-03-20 22:32:34 -07:00
parent 31264ac7d1
commit dd811ac423
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 9 additions and 10 deletions

View file

@ -245,14 +245,9 @@ void ProxyWindowBase::updateMask() {
auto windowRegion = QRegion(QRect(0, 0, this->width(), this->height())); auto windowRegion = QRegion(QRect(0, 0, this->width(), this->height()));
mask = this->mMask->applyTo(windowRegion); mask = this->mMask->applyTo(windowRegion);
} }
if (mask.isEmpty()) {
this->window->setFlag(Qt::WindowTransparentForInput, true);
}
} else {
this->window->setFlag(Qt::WindowTransparentForInput, false);
} }
this->window->setFlag(Qt::WindowTransparentForInput, this->mMask != nullptr && mask.isEmpty());
this->window->setMask(mask); this->window->setMask(mask);
} }

View file

@ -26,10 +26,14 @@ void PendingRegion::setItem(QQuickItem* item) {
this->mItem = item; this->mItem = item;
QObject::connect(this->mItem, &QQuickItem::xChanged, this, &PendingRegion::itemChanged); if (item != nullptr) {
QObject::connect(this->mItem, &QQuickItem::yChanged, this, &PendingRegion::itemChanged); QObject::connect(this->mItem, &QQuickItem::xChanged, this, &PendingRegion::itemChanged);
QObject::connect(this->mItem, &QQuickItem::widthChanged, this, &PendingRegion::itemChanged); QObject::connect(this->mItem, &QQuickItem::yChanged, this, &PendingRegion::itemChanged);
QObject::connect(this->mItem, &QQuickItem::heightChanged, this, &PendingRegion::itemChanged); QObject::connect(this->mItem, &QQuickItem::widthChanged, this, &PendingRegion::itemChanged);
QObject::connect(this->mItem, &QQuickItem::heightChanged, this, &PendingRegion::itemChanged);
}
emit this->itemChanged();
} }
void PendingRegion::onItemDestroyed() { this->mItem = nullptr; } void PendingRegion::onItemDestroyed() { this->mItem = nullptr; }