forked from quickshell/quickshell
		
	core/popupwindow: wait for polish to reposition
This commit is contained in:
		
							parent
							
								
									b67f92bc13
								
							
						
					
					
						commit
						adcef7fc30
					
				
					 2 changed files with 17 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -126,7 +126,20 @@ qint32 ProxyPopupWindow::relativeY() const {
 | 
			
		|||
PopupAnchor* ProxyPopupWindow::anchor() { return &this->mAnchor; }
 | 
			
		||||
 | 
			
		||||
void ProxyPopupWindow::reposition() {
 | 
			
		||||
	if (this->window != nullptr) {
 | 
			
		||||
		PopupPositioner::instance()->reposition(&this->mAnchor, this->window);
 | 
			
		||||
	// not gated on pendingReposition as a polish might not be triggered in edge cases
 | 
			
		||||
	if (this->window) {
 | 
			
		||||
		this->pendingReposition = true;
 | 
			
		||||
		this->schedulePolish();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ProxyPopupWindow::onPolished() {
 | 
			
		||||
	this->ProxyWindowBase::onPolished();
 | 
			
		||||
	if (this->pendingReposition) {
 | 
			
		||||
		this->pendingReposition = false;
 | 
			
		||||
 | 
			
		||||
		if (this->window) {
 | 
			
		||||
			PopupPositioner::instance()->reposition(&this->mAnchor, this->window);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,6 +87,7 @@ public:
 | 
			
		|||
 | 
			
		||||
	void completeWindow() override;
 | 
			
		||||
	void postCompleteWindow() override;
 | 
			
		||||
	void onPolished() override;
 | 
			
		||||
 | 
			
		||||
	void setScreen(QuickshellScreenInfo* screen) override;
 | 
			
		||||
	void setVisible(bool visible) override;
 | 
			
		||||
| 
						 | 
				
			
			@ -119,4 +120,5 @@ private:
 | 
			
		|||
 | 
			
		||||
	PopupAnchor mAnchor {this};
 | 
			
		||||
	bool wantsVisible = false;
 | 
			
		||||
	bool pendingReposition = false;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue