forked from quickshell/quickshell
		
	core/window: clean up window interface property proxies
This commit is contained in:
		
							parent
							
								
									5ac9096c1c
								
							
						
					
					
						commit
						5706c09e6f
					
				
					 8 changed files with 87 additions and 233 deletions
				
			
		| 
						 | 
				
			
			@ -414,23 +414,9 @@ void XPanelWindow::updateFocusable() {
 | 
			
		|||
XPanelInterface::XPanelInterface(QObject* parent)
 | 
			
		||||
    : PanelWindowInterface(parent)
 | 
			
		||||
    , panel(new XPanelWindow(this)) {
 | 
			
		||||
	this->connectSignals();
 | 
			
		||||
 | 
			
		||||
	// clang-format off
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::windowConnected, this, &XPanelInterface::windowConnected);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::visibleChanged, this, &XPanelInterface::visibleChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::backerVisibilityChanged, this, &XPanelInterface::backingWindowVisibleChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::implicitHeightChanged, this, &XPanelInterface::implicitHeightChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::implicitWidthChanged, this, &XPanelInterface::implicitWidthChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::heightChanged, this, &XPanelInterface::heightChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::widthChanged, this, &XPanelInterface::widthChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::devicePixelRatioChanged, this, &XPanelInterface::devicePixelRatioChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::screenChanged, this, &XPanelInterface::screenChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::windowTransformChanged, this, &XPanelInterface::windowTransformChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::colorChanged, this, &XPanelInterface::colorChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::maskChanged, this, &XPanelInterface::maskChanged);
 | 
			
		||||
	QObject::connect(this->panel, &ProxyWindowBase::surfaceFormatChanged, this, &XPanelInterface::surfaceFormatChanged);
 | 
			
		||||
 | 
			
		||||
	// panel specific
 | 
			
		||||
	QObject::connect(this->panel, &XPanelWindow::anchorsChanged, this, &XPanelInterface::anchorsChanged);
 | 
			
		||||
	QObject::connect(this->panel, &XPanelWindow::marginsChanged, this, &XPanelInterface::marginsChanged);
 | 
			
		||||
	QObject::connect(this->panel, &XPanelWindow::exclusiveZoneChanged, this, &XPanelInterface::exclusiveZoneChanged);
 | 
			
		||||
| 
						 | 
				
			
			@ -447,28 +433,13 @@ void XPanelInterface::onReload(QObject* oldInstance) {
 | 
			
		|||
	this->panel->reload(old != nullptr ? old->panel : nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QQmlListProperty<QObject> XPanelInterface::data() { return this->panel->data(); }
 | 
			
		||||
ProxyWindowBase* XPanelInterface::proxyWindow() const { return this->panel; }
 | 
			
		||||
QQuickItem* XPanelInterface::contentItem() const { return this->panel->contentItem(); }
 | 
			
		||||
bool XPanelInterface::isBackingWindowVisible() const { return this->panel->isVisibleDirect(); }
 | 
			
		||||
qreal XPanelInterface::devicePixelRatio() const { return this->panel->devicePixelRatio(); }
 | 
			
		||||
 | 
			
		||||
// NOLINTBEGIN
 | 
			
		||||
#define proxyPair(type, get, set)                                                                  \
 | 
			
		||||
	type XPanelInterface::get() const { return this->panel->get(); }                                 \
 | 
			
		||||
	void XPanelInterface::set(type value) { this->panel->set(value); }
 | 
			
		||||
 | 
			
		||||
proxyPair(bool, isVisible, setVisible);
 | 
			
		||||
proxyPair(qint32, implicitWidth, setImplicitWidth);
 | 
			
		||||
proxyPair(qint32, implicitHeight, setImplicitHeight);
 | 
			
		||||
proxyPair(qint32, width, setWidth);
 | 
			
		||||
proxyPair(qint32, height, setHeight);
 | 
			
		||||
proxyPair(QuickshellScreenInfo*, screen, setScreen);
 | 
			
		||||
proxyPair(QColor, color, setColor);
 | 
			
		||||
proxyPair(PendingRegion*, mask, setMask);
 | 
			
		||||
proxyPair(QsSurfaceFormat, surfaceFormat, setSurfaceFormat);
 | 
			
		||||
 | 
			
		||||
// panel specific
 | 
			
		||||
proxyPair(Anchors, anchors, setAnchors);
 | 
			
		||||
proxyPair(Margins, margins, setMargins);
 | 
			
		||||
proxyPair(qint32, exclusiveZone, setExclusiveZone);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -135,43 +135,8 @@ public:
 | 
			
		|||
	void onReload(QObject* oldInstance) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] ProxyWindowBase* proxyWindow() const override;
 | 
			
		||||
	[[nodiscard]] QQuickItem* contentItem() const override;
 | 
			
		||||
 | 
			
		||||
	// NOLINTBEGIN
 | 
			
		||||
	[[nodiscard]] bool isVisible() const override;
 | 
			
		||||
	[[nodiscard]] bool isBackingWindowVisible() const override;
 | 
			
		||||
	void setVisible(bool visible) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] qint32 implicitWidth() const override;
 | 
			
		||||
	void setImplicitWidth(qint32 implicitWidth) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] qint32 implicitHeight() const override;
 | 
			
		||||
	void setImplicitHeight(qint32 implicitHeight) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] qint32 width() const override;
 | 
			
		||||
	void setWidth(qint32 width) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] qint32 height() const override;
 | 
			
		||||
	void setHeight(qint32 height) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual qreal devicePixelRatio() const override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] QuickshellScreenInfo* screen() const override;
 | 
			
		||||
	void setScreen(QuickshellScreenInfo* screen) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] QColor color() const override;
 | 
			
		||||
	void setColor(QColor color) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] PendingRegion* mask() const override;
 | 
			
		||||
	void setMask(PendingRegion* mask) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] QsSurfaceFormat surfaceFormat() const override;
 | 
			
		||||
	void setSurfaceFormat(QsSurfaceFormat mask) override;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] QQmlListProperty<QObject> data() override;
 | 
			
		||||
 | 
			
		||||
	// panel specific
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] Anchors anchors() const override;
 | 
			
		||||
	void setAnchors(Anchors anchors) override;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue