core/window: clean up window interface property proxies

This commit is contained in:
outfoxxed 2025-07-15 14:06:26 -07:00
parent 5ac9096c1c
commit 5706c09e6f
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
8 changed files with 87 additions and 233 deletions

View file

@ -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();