forked from quickshell/quickshell
feat(wayland): create cross platform window interfaces
Internally this also refactors a ton of code around the wayland layershell. Note that attachment failures are still broken and platform interfaces are hardcoded.
This commit is contained in:
parent
4a82949854
commit
c2930783ea
20 changed files with 591 additions and 402 deletions
62
src/core/floatingwindow.cpp
Normal file
62
src/core/floatingwindow.cpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
#include "floatingwindow.hpp"
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qqmllist.h>
|
||||
#include <qquickitem.h>
|
||||
#include <qtypes.h>
|
||||
|
||||
#include "proxywindow.hpp"
|
||||
#include "windowinterface.hpp"
|
||||
|
||||
void ProxyFloatingWindow::setWidth(qint32 width) {
|
||||
if (this->window == nullptr || !this->window->isVisible()) {
|
||||
this->ProxyWindowBase::setWidth(width);
|
||||
}
|
||||
}
|
||||
|
||||
void ProxyFloatingWindow::setHeight(qint32 height) {
|
||||
if (this->window == nullptr || !this->window->isVisible()) {
|
||||
this->ProxyWindowBase::setHeight(height);
|
||||
}
|
||||
}
|
||||
|
||||
// FloatingWindowInterface
|
||||
|
||||
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::heightChanged, this, &FloatingWindowInterface::heightChanged);
|
||||
QObject::connect(this->window, &ProxyWindowBase::widthChanged, this, &FloatingWindowInterface::widthChanged);
|
||||
QObject::connect(this->window, &ProxyWindowBase::screenChanged, this, &FloatingWindowInterface::screenChanged);
|
||||
QObject::connect(this->window, &ProxyWindowBase::colorChanged, this, &FloatingWindowInterface::colorChanged);
|
||||
QObject::connect(this->window, &ProxyWindowBase::maskChanged, this, &FloatingWindowInterface::maskChanged);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void FloatingWindowInterface::onReload(QObject* oldInstance) {
|
||||
auto* old = qobject_cast<FloatingWindowInterface*>(oldInstance);
|
||||
this->window->onReload(old != nullptr ? old->window : nullptr);
|
||||
}
|
||||
|
||||
QQmlListProperty<QObject> FloatingWindowInterface::data() { return this->window->data(); }
|
||||
QQuickItem* FloatingWindowInterface::contentItem() const { return this->window->contentItem(); }
|
||||
|
||||
// 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, width, setWidth);
|
||||
proxyPair(qint32, height, setHeight);
|
||||
proxyPair(QuickShellScreenInfo*, screen, setScreen);
|
||||
proxyPair(QColor, color, setColor);
|
||||
proxyPair(PendingRegion*, mask, setMask);
|
||||
|
||||
#undef proxyPair
|
||||
#undef proxySet
|
||||
#undef proxyGet
|
||||
// NOLINTEND
|
Loading…
Add table
Add a link
Reference in a new issue