forked from quickshell/quickshell
		
	x11/panelwindow: use Qt window default screen if none is provided
Fixes panels not updating geometry or attachments under X if a screen was not explicitly provided by the user.
This commit is contained in:
		
							parent
							
								
									9604302415
								
							
						
					
					
						commit
						59d29bb254
					
				
					 2 changed files with 14 additions and 9 deletions
				
			
		| 
						 | 
					@ -126,7 +126,7 @@ void XPanelWindow::connectWindow() {
 | 
				
			||||||
	this->ProxyWindowBase::connectWindow();
 | 
						this->ProxyWindowBase::connectWindow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->window->installEventFilter(&this->eventFilter);
 | 
						this->window->installEventFilter(&this->eventFilter);
 | 
				
			||||||
	this->connectScreen();
 | 
						this->updateScreen();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QObject::connect(
 | 
						QObject::connect(
 | 
				
			||||||
	    this->window,
 | 
						    this->window,
 | 
				
			||||||
| 
						 | 
					@ -169,7 +169,7 @@ void XPanelWindow::trySetHeight(qint32 implicitHeight) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void XPanelWindow::setScreen(QuickshellScreenInfo* screen) {
 | 
					void XPanelWindow::setScreen(QuickshellScreenInfo* screen) {
 | 
				
			||||||
	this->ProxyWindowBase::setScreen(screen);
 | 
						this->ProxyWindowBase::setScreen(screen);
 | 
				
			||||||
	this->connectScreen();
 | 
						this->updateScreen();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void XPanelWindow::xInit() {
 | 
					void XPanelWindow::xInit() {
 | 
				
			||||||
| 
						 | 
					@ -192,12 +192,17 @@ void XPanelWindow::xInit() {
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void XPanelWindow::connectScreen() {
 | 
					void XPanelWindow::updateScreen() {
 | 
				
			||||||
 | 
						auto* newScreen =
 | 
				
			||||||
 | 
						    this->mScreen ? this->mScreen : (this->window ? this->window->screen() : nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (newScreen == this->mTrackedScreen) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->mTrackedScreen != nullptr) {
 | 
						if (this->mTrackedScreen != nullptr) {
 | 
				
			||||||
		QObject::disconnect(this->mTrackedScreen, nullptr, this, nullptr);
 | 
							QObject::disconnect(this->mTrackedScreen, nullptr, this, nullptr);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->mTrackedScreen = this->mScreen;
 | 
						this->mTrackedScreen = newScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->mTrackedScreen != nullptr) {
 | 
						if (this->mTrackedScreen != nullptr) {
 | 
				
			||||||
		QObject::connect(
 | 
							QObject::connect(
 | 
				
			||||||
| 
						 | 
					@ -212,7 +217,6 @@ void XPanelWindow::connectScreen() {
 | 
				
			||||||
		    &QScreen::virtualGeometryChanged,
 | 
							    &QScreen::virtualGeometryChanged,
 | 
				
			||||||
		    this,
 | 
							    this,
 | 
				
			||||||
		    &XPanelWindow::onScreenVirtualGeometryChanged
 | 
							    &XPanelWindow::onScreenVirtualGeometryChanged
 | 
				
			||||||
 | 
					 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,10 +235,11 @@ void XPanelWindow::onScreenVirtualGeometryChanged() {
 | 
				
			||||||
void XPanelWindow::updateDimensionsSlot() { this->updateDimensions(); }
 | 
					void XPanelWindow::updateDimensionsSlot() { this->updateDimensions(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void XPanelWindow::updateDimensions(bool propagate) {
 | 
					void XPanelWindow::updateDimensions(bool propagate) {
 | 
				
			||||||
	if (this->window == nullptr || this->window->handle() == nullptr || this->mScreen == nullptr)
 | 
						if (this->window == nullptr || this->window->handle() == nullptr
 | 
				
			||||||
 | 
						    || this->mTrackedScreen == nullptr)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto screenGeometry = this->mScreen->geometry();
 | 
						auto screenGeometry = this->mTrackedScreen->geometry();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->bExclusionMode != ExclusionMode::Ignore) {
 | 
						if (this->bExclusionMode != ExclusionMode::Ignore) {
 | 
				
			||||||
		for (auto* panel: XPanelStack::instance()->panels(this)) {
 | 
							for (auto* panel: XPanelStack::instance()->panels(this)) {
 | 
				
			||||||
| 
						 | 
					@ -244,7 +249,7 @@ void XPanelWindow::updateDimensions(bool propagate) {
 | 
				
			||||||
			// we only care about windows in the same layer
 | 
								// we only care about windows in the same layer
 | 
				
			||||||
			if (panel->bAboveWindows != this->bAboveWindows) continue;
 | 
								if (panel->bAboveWindows != this->bAboveWindows) continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (panel->mScreen != this->mScreen) continue;
 | 
								if (panel->mTrackedScreen != this->mTrackedScreen) continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			auto edge = this->bcExclusionEdge.value();
 | 
								auto edge = this->bcExclusionEdge.value();
 | 
				
			||||||
			auto exclusiveZone = this->bcExclusiveZone.value();
 | 
								auto exclusiveZone = this->bcExclusiveZone.value();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ private slots:
 | 
				
			||||||
	void onScreenVirtualGeometryChanged();
 | 
						void onScreenVirtualGeometryChanged();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	void connectScreen();
 | 
						void updateScreen();
 | 
				
			||||||
	void updateStrut(bool propagate = true);
 | 
						void updateStrut(bool propagate = true);
 | 
				
			||||||
	void updateStrutCb() { this->updateStrut(); }
 | 
						void updateStrutCb() { this->updateStrut(); }
 | 
				
			||||||
	void updateAboveWindows();
 | 
						void updateAboveWindows();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue