forked from quickshell/quickshell
		
	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:
		
							parent
							
								
									31264ac7d1
								
							
						
					
					
						commit
						dd811ac423
					
				
					 2 changed files with 9 additions and 10 deletions
				
			
		| 
						 | 
					@ -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);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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; }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue