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
				
			
		| 
						 | 
				
			
			@ -5,7 +5,6 @@
 | 
			
		|||
#include <qobject.h>
 | 
			
		||||
#include <qqmllist.h>
 | 
			
		||||
#include <qquickitem.h>
 | 
			
		||||
#include <qquickwindow.h>
 | 
			
		||||
#include <qtypes.h>
 | 
			
		||||
 | 
			
		||||
#include "../../core/qmlscreen.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -173,23 +172,9 @@ WlrLayershell* WlrLayershell::qmlAttachedProperties(QObject* object) {
 | 
			
		|||
WaylandPanelInterface::WaylandPanelInterface(QObject* parent)
 | 
			
		||||
    : PanelWindowInterface(parent)
 | 
			
		||||
    , layer(new WlrLayershell(this)) {
 | 
			
		||||
	this->connectSignals();
 | 
			
		||||
 | 
			
		||||
	// clang-format off
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::windowConnected, this, &WaylandPanelInterface::windowConnected);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::visibleChanged, this, &WaylandPanelInterface::visibleChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::backerVisibilityChanged, this, &WaylandPanelInterface::backingWindowVisibleChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::implicitHeightChanged, this, &WaylandPanelInterface::implicitHeightChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::implicitWidthChanged, this, &WaylandPanelInterface::implicitWidthChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::heightChanged, this, &WaylandPanelInterface::heightChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::widthChanged, this, &WaylandPanelInterface::widthChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::devicePixelRatioChanged, this, &WaylandPanelInterface::devicePixelRatioChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::screenChanged, this, &WaylandPanelInterface::screenChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::windowTransformChanged, this, &WaylandPanelInterface::windowTransformChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::colorChanged, this, &WaylandPanelInterface::colorChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::maskChanged, this, &WaylandPanelInterface::maskChanged);
 | 
			
		||||
	QObject::connect(this->layer, &ProxyWindowBase::surfaceFormatChanged, this, &WaylandPanelInterface::surfaceFormatChanged);
 | 
			
		||||
 | 
			
		||||
	// panel specific
 | 
			
		||||
	QObject::connect(this->layer, &WlrLayershell::anchorsChanged, this, &WaylandPanelInterface::anchorsChanged);
 | 
			
		||||
	QObject::connect(this->layer, &WlrLayershell::marginsChanged, this, &WaylandPanelInterface::marginsChanged);
 | 
			
		||||
	QObject::connect(this->layer, &WlrLayershell::exclusiveZoneChanged, this, &WaylandPanelInterface::exclusiveZoneChanged);
 | 
			
		||||
| 
						 | 
				
			
			@ -206,32 +191,13 @@ void WaylandPanelInterface::onReload(QObject* oldInstance) {
 | 
			
		|||
	this->layer->reload(old != nullptr ? old->layer : nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QQmlListProperty<QObject> WaylandPanelInterface::data() { return this->layer->data(); }
 | 
			
		||||
ProxyWindowBase* WaylandPanelInterface::proxyWindow() const { return this->layer; }
 | 
			
		||||
QQuickItem* WaylandPanelInterface::contentItem() const { return this->layer->contentItem(); }
 | 
			
		||||
 | 
			
		||||
bool WaylandPanelInterface::isBackingWindowVisible() const {
 | 
			
		||||
	return this->layer->isVisibleDirect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
qreal WaylandPanelInterface::devicePixelRatio() const { return this->layer->devicePixelRatio(); }
 | 
			
		||||
 | 
			
		||||
// NOLINTBEGIN
 | 
			
		||||
#define proxyPair(type, get, set)                                                                  \
 | 
			
		||||
	type WaylandPanelInterface::get() const { return this->layer->get(); }                           \
 | 
			
		||||
	void WaylandPanelInterface::set(type value) { this->layer->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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -216,43 +216,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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
#include <qobject.h>
 | 
			
		||||
#include <qqmlengine.h>
 | 
			
		||||
#include <qqmllist.h>
 | 
			
		||||
#include <qquickitem.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
#include <qtypes.h>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -50,21 +49,9 @@ void ProxyFloatingWindow::onMaximumSizeChanged() {
 | 
			
		|||
FloatingWindowInterface::FloatingWindowInterface(QObject* parent)
 | 
			
		||||
    : WindowInterface(parent)
 | 
			
		||||
    , window(new ProxyFloatingWindow(this)) {
 | 
			
		||||
	// clang-format off
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::windowConnected, this, &FloatingWindowInterface::windowConnected);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::visibleChanged, this, &FloatingWindowInterface::visibleChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::backerVisibilityChanged, this, &FloatingWindowInterface::backingWindowVisibleChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::heightChanged, this, &FloatingWindowInterface::heightChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::widthChanged, this, &FloatingWindowInterface::widthChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::implicitHeightChanged, this, &FloatingWindowInterface::implicitHeightChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::implicitWidthChanged, this, &FloatingWindowInterface::implicitWidthChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::devicePixelRatioChanged, this, &FloatingWindowInterface::devicePixelRatioChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::screenChanged, this, &FloatingWindowInterface::screenChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::windowTransformChanged, this, &FloatingWindowInterface::windowTransformChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::colorChanged, this, &FloatingWindowInterface::colorChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::maskChanged, this, &FloatingWindowInterface::maskChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyWindowBase::surfaceFormatChanged, this, &FloatingWindowInterface::surfaceFormatChanged);
 | 
			
		||||
	this->connectSignals();
 | 
			
		||||
 | 
			
		||||
	// clang-format off
 | 
			
		||||
	QObject::connect(this->window, &ProxyFloatingWindow::titleChanged, this, &FloatingWindowInterface::titleChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyFloatingWindow::minimumSizeChanged, this, &FloatingWindowInterface::minimumSizeChanged);
 | 
			
		||||
	QObject::connect(this->window, &ProxyFloatingWindow::maximumSizeChanged, this, &FloatingWindowInterface::maximumSizeChanged);
 | 
			
		||||
| 
						 | 
				
			
			@ -78,30 +65,4 @@ void FloatingWindowInterface::onReload(QObject* oldInstance) {
 | 
			
		|||
	this->window->reload(old != nullptr ? old->window : nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QQmlListProperty<QObject> FloatingWindowInterface::data() { return this->window->data(); }
 | 
			
		||||
ProxyWindowBase* FloatingWindowInterface::proxyWindow() const { return this->window; }
 | 
			
		||||
QQuickItem* FloatingWindowInterface::contentItem() const { return this->window->contentItem(); }
 | 
			
		||||
 | 
			
		||||
bool FloatingWindowInterface::isBackingWindowVisible() const {
 | 
			
		||||
	return this->window->isVisibleDirect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
qreal FloatingWindowInterface::devicePixelRatio() const { return this->window->devicePixelRatio(); }
 | 
			
		||||
 | 
			
		||||
// NOLINTBEGIN
 | 
			
		||||
#define proxyPair(type, get, set)                                                                  \
 | 
			
		||||
	type FloatingWindowInterface::get() const { return this->window->get(); }                        \
 | 
			
		||||
	void FloatingWindowInterface::set(type value) { this->window->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);
 | 
			
		||||
 | 
			
		||||
#undef proxyPair
 | 
			
		||||
// NOLINTEND
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,41 +77,6 @@ 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;
 | 
			
		||||
	// NOLINTEND
 | 
			
		||||
 | 
			
		||||
	QBindable<QSize> bindableMinimumSize() { return &this->window->bMinimumSize; }
 | 
			
		||||
	QBindable<QSize> bindableMaximumSize() { return &this->window->bMaximumSize; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,9 +2,12 @@
 | 
			
		|||
 | 
			
		||||
#include <qlogging.h>
 | 
			
		||||
#include <qobject.h>
 | 
			
		||||
#include <qqmllist.h>
 | 
			
		||||
#include <qquickitem.h>
 | 
			
		||||
#include <qtypes.h>
 | 
			
		||||
 | 
			
		||||
#include "../core/qmlscreen.hpp"
 | 
			
		||||
#include "../core/region.hpp"
 | 
			
		||||
#include "proxywindow.hpp"
 | 
			
		||||
 | 
			
		||||
QPointF WindowInterface::itemPosition(QQuickItem* item) const {
 | 
			
		||||
| 
						 | 
				
			
			@ -91,6 +94,61 @@ QsWindowAttached::mapFromItem(QQuickItem* item, qreal x, qreal y, qreal width, q
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// clang-format off
 | 
			
		||||
QQuickItem* WindowInterface::contentItem() const { return this->proxyWindow()->contentItem(); }
 | 
			
		||||
 | 
			
		||||
bool WindowInterface::isVisible() const { return this->proxyWindow()->isVisible(); };
 | 
			
		||||
bool WindowInterface::isBackingWindowVisible() const { return this->proxyWindow()->isVisibleDirect(); };
 | 
			
		||||
void WindowInterface::setVisible(bool visible) const { this->proxyWindow()->setVisible(visible); };
 | 
			
		||||
 | 
			
		||||
qint32 WindowInterface::implicitWidth() const { return this->proxyWindow()->implicitWidth(); };
 | 
			
		||||
void WindowInterface::setImplicitWidth(qint32 implicitWidth) const { this->proxyWindow()->setImplicitWidth(implicitWidth); };
 | 
			
		||||
 | 
			
		||||
qint32 WindowInterface::implicitHeight() const { return this->proxyWindow()->implicitHeight(); };
 | 
			
		||||
void WindowInterface::setImplicitHeight(qint32 implicitHeight) const { this->proxyWindow()->setImplicitHeight(implicitHeight); };
 | 
			
		||||
 | 
			
		||||
qint32 WindowInterface::width() const { return this->proxyWindow()->width(); };
 | 
			
		||||
void WindowInterface::setWidth(qint32 width) const { this->proxyWindow()->setWidth(width); };
 | 
			
		||||
 | 
			
		||||
qint32 WindowInterface::height() const { return this->proxyWindow()->height(); };
 | 
			
		||||
void WindowInterface::setHeight(qint32 height) const { this->proxyWindow()->setHeight(height); };
 | 
			
		||||
 | 
			
		||||
qreal WindowInterface::devicePixelRatio() const { return this->proxyWindow()->devicePixelRatio(); };
 | 
			
		||||
 | 
			
		||||
QuickshellScreenInfo* WindowInterface::screen() const { return this->proxyWindow()->screen(); };
 | 
			
		||||
void WindowInterface::setScreen(QuickshellScreenInfo* screen) const { this->proxyWindow()->setScreen(screen); };
 | 
			
		||||
 | 
			
		||||
QColor WindowInterface::color() const { return this->proxyWindow()->color(); };
 | 
			
		||||
void WindowInterface::setColor(QColor color) const { this->proxyWindow()->setColor(color); };
 | 
			
		||||
 | 
			
		||||
PendingRegion* WindowInterface::mask() const { return this->proxyWindow()->mask(); };
 | 
			
		||||
void WindowInterface::setMask(PendingRegion* mask) const { this->proxyWindow()->setMask(mask); };
 | 
			
		||||
 | 
			
		||||
QsSurfaceFormat WindowInterface::surfaceFormat() const { return this->proxyWindow()->surfaceFormat(); };
 | 
			
		||||
void WindowInterface::setSurfaceFormat(QsSurfaceFormat format) const { this->proxyWindow()->setSurfaceFormat(format); };
 | 
			
		||||
 | 
			
		||||
QQmlListProperty<QObject> WindowInterface::data() const { return this->proxyWindow()->data(); };
 | 
			
		||||
// clang-format on
 | 
			
		||||
 | 
			
		||||
void WindowInterface::connectSignals() const {
 | 
			
		||||
	auto* window = this->proxyWindow();
 | 
			
		||||
	// clang-format off
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::windowConnected, this, &WindowInterface::windowConnected);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::visibleChanged, this, &WindowInterface::visibleChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::backerVisibilityChanged, this, &WindowInterface::backingWindowVisibleChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::implicitHeightChanged, this, &WindowInterface::implicitHeightChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::implicitWidthChanged, this, &WindowInterface::implicitWidthChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::heightChanged, this, &WindowInterface::heightChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::widthChanged, this, &WindowInterface::widthChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::devicePixelRatioChanged, this, &WindowInterface::devicePixelRatioChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::screenChanged, this, &WindowInterface::screenChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::windowTransformChanged, this, &WindowInterface::windowTransformChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::colorChanged, this, &WindowInterface::colorChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::maskChanged, this, &WindowInterface::maskChanged);
 | 
			
		||||
	QObject::connect(window, &ProxyWindowBase::surfaceFormatChanged, this, &WindowInterface::surfaceFormatChanged);
 | 
			
		||||
	// clang-format on
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QsWindowAttached* WindowInterface::qmlAttachedProperties(QObject* object) {
 | 
			
		||||
	while (object && !qobject_cast<QQuickItem*>(object)) {
 | 
			
		||||
		object = object->parent();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -197,41 +197,41 @@ public:
 | 
			
		|||
	// clang-format on
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual ProxyWindowBase* proxyWindow() const = 0;
 | 
			
		||||
	[[nodiscard]] virtual QQuickItem* contentItem() const = 0;
 | 
			
		||||
	[[nodiscard]] QQuickItem* contentItem() const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual bool isVisible() const = 0;
 | 
			
		||||
	[[nodiscard]] virtual bool isBackingWindowVisible() const = 0;
 | 
			
		||||
	virtual void setVisible(bool visible) = 0;
 | 
			
		||||
	[[nodiscard]] bool isVisible() const;
 | 
			
		||||
	[[nodiscard]] bool isBackingWindowVisible() const;
 | 
			
		||||
	void setVisible(bool visible) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual qint32 implicitWidth() const = 0;
 | 
			
		||||
	virtual void setImplicitWidth(qint32 implicitWidth) = 0;
 | 
			
		||||
	[[nodiscard]] qint32 implicitWidth() const;
 | 
			
		||||
	void setImplicitWidth(qint32 implicitWidth) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual qint32 implicitHeight() const = 0;
 | 
			
		||||
	virtual void setImplicitHeight(qint32 implicitHeight) = 0;
 | 
			
		||||
	[[nodiscard]] qint32 implicitHeight() const;
 | 
			
		||||
	void setImplicitHeight(qint32 implicitHeight) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual qint32 width() const = 0;
 | 
			
		||||
	virtual void setWidth(qint32 width) = 0;
 | 
			
		||||
	[[nodiscard]] qint32 width() const;
 | 
			
		||||
	void setWidth(qint32 width) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual qint32 height() const = 0;
 | 
			
		||||
	virtual void setHeight(qint32 height) = 0;
 | 
			
		||||
	[[nodiscard]] qint32 height() const;
 | 
			
		||||
	void setHeight(qint32 height) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual qreal devicePixelRatio() const = 0;
 | 
			
		||||
	[[nodiscard]] qreal devicePixelRatio() const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual QuickshellScreenInfo* screen() const = 0;
 | 
			
		||||
	virtual void setScreen(QuickshellScreenInfo* screen) = 0;
 | 
			
		||||
	[[nodiscard]] QuickshellScreenInfo* screen() const;
 | 
			
		||||
	void setScreen(QuickshellScreenInfo* screen) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] QObject* windowTransform() const { return nullptr; } // NOLINT
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual QColor color() const = 0;
 | 
			
		||||
	virtual void setColor(QColor color) = 0;
 | 
			
		||||
	[[nodiscard]] QColor color() const;
 | 
			
		||||
	void setColor(QColor color) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual PendingRegion* mask() const = 0;
 | 
			
		||||
	virtual void setMask(PendingRegion* mask) = 0;
 | 
			
		||||
	[[nodiscard]] PendingRegion* mask() const;
 | 
			
		||||
	void setMask(PendingRegion* mask) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual QsSurfaceFormat surfaceFormat() const = 0;
 | 
			
		||||
	virtual void setSurfaceFormat(QsSurfaceFormat format) = 0;
 | 
			
		||||
	[[nodiscard]] QsSurfaceFormat surfaceFormat() const;
 | 
			
		||||
	void setSurfaceFormat(QsSurfaceFormat format) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] virtual QQmlListProperty<QObject> data() = 0;
 | 
			
		||||
	[[nodiscard]] QQmlListProperty<QObject> data() const;
 | 
			
		||||
 | 
			
		||||
	static QsWindowAttached* qmlAttachedProperties(QObject* object);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -249,6 +249,9 @@ signals:
 | 
			
		|||
	void colorChanged();
 | 
			
		||||
	void maskChanged();
 | 
			
		||||
	void surfaceFormatChanged();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	void connectSignals() const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class QsWindowAttached: public QObject {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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