forked from quickshell/quickshell
wayland: namespace type names a bit to prevent future conflicts
This commit is contained in:
parent
1e647cee51
commit
3480707e99
2
examples
2
examples
|
@ -1 +1 @@
|
||||||
Subproject commit 9437c6a840faf7180ab7dfb5425a402ca8a4b58c
|
Subproject commit 9838d7972414fa6c242db8a9486878e09ea595e6
|
|
@ -18,8 +18,8 @@
|
||||||
#include "../core/reload.hpp"
|
#include "../core/reload.hpp"
|
||||||
#include "session_lock/session_lock.hpp"
|
#include "session_lock/session_lock.hpp"
|
||||||
|
|
||||||
void SessionLock::onReload(QObject* oldInstance) {
|
void WlSessionLock::onReload(QObject* oldInstance) {
|
||||||
auto* old = qobject_cast<SessionLock*>(oldInstance);
|
auto* old = qobject_cast<WlSessionLock*>(oldInstance);
|
||||||
|
|
||||||
if (old != nullptr) {
|
if (old != nullptr) {
|
||||||
QObject::disconnect(old->manager, nullptr, old, nullptr);
|
QObject::disconnect(old->manager, nullptr, old, nullptr);
|
||||||
|
@ -30,18 +30,18 @@ void SessionLock::onReload(QObject* oldInstance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
QObject::connect(this->manager, &SessionLockManager::locked, this, &SessionLock::secureStateChanged);
|
QObject::connect(this->manager, &SessionLockManager::locked, this, &WlSessionLock::secureStateChanged);
|
||||||
QObject::connect(this->manager, &SessionLockManager::unlocked, this, &SessionLock::secureStateChanged);
|
QObject::connect(this->manager, &SessionLockManager::unlocked, this, &WlSessionLock::secureStateChanged);
|
||||||
|
|
||||||
QObject::connect(this->manager, &SessionLockManager::unlocked, this, &SessionLock::unlock);
|
QObject::connect(this->manager, &SessionLockManager::unlocked, this, &WlSessionLock::unlock);
|
||||||
|
|
||||||
auto* app = QCoreApplication::instance();
|
auto* app = QCoreApplication::instance();
|
||||||
auto* guiApp = qobject_cast<QGuiApplication*>(app);
|
auto* guiApp = qobject_cast<QGuiApplication*>(app);
|
||||||
|
|
||||||
if (guiApp != nullptr) {
|
if (guiApp != nullptr) {
|
||||||
QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &SessionLock::onScreensChanged);
|
QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &WlSessionLock::onScreensChanged);
|
||||||
QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &SessionLock::onScreensChanged);
|
QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &WlSessionLock::onScreensChanged);
|
||||||
QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &SessionLock::onScreensChanged);
|
QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &WlSessionLock::onScreensChanged);
|
||||||
}
|
}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void SessionLock::onReload(QObject* oldInstance) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLock::updateSurfaces(SessionLock* old) {
|
void WlSessionLock::updateSurfaces(WlSessionLock* old) {
|
||||||
if (this->manager->isLocked()) {
|
if (this->manager->isLocked()) {
|
||||||
auto screens = QGuiApplication::screens();
|
auto screens = QGuiApplication::screens();
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ void SessionLock::updateSurfaces(SessionLock* old) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->mSurfaceComponent == nullptr) {
|
if (this->mSurfaceComponent == nullptr) {
|
||||||
qWarning() << "SessionLock.surface is null. Aborting lock.";
|
qWarning() << "WlSessionLock.surface is null. Aborting lock.";
|
||||||
this->unlock();
|
this->unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,10 @@ void SessionLock::updateSurfaces(SessionLock* old) {
|
||||||
if (!this->surfaces.contains(screen)) {
|
if (!this->surfaces.contains(screen)) {
|
||||||
auto* instanceObj =
|
auto* instanceObj =
|
||||||
this->mSurfaceComponent->create(QQmlEngine::contextForObject(this->mSurfaceComponent));
|
this->mSurfaceComponent->create(QQmlEngine::contextForObject(this->mSurfaceComponent));
|
||||||
auto* instance = qobject_cast<SessionLockSurface*>(instanceObj);
|
auto* instance = qobject_cast<WlSessionLockSurface*>(instanceObj);
|
||||||
|
|
||||||
if (instance == nullptr) {
|
if (instance == nullptr) {
|
||||||
qWarning() << "SessionLock.surface does not create a SessionLockSurface. Aborting lock.";
|
qWarning() << "WlSessionLock.surface does not create a WlSessionLockSurface. Aborting lock.";
|
||||||
if (instanceObj != nullptr) instanceObj->deleteLater();
|
if (instanceObj != nullptr) instanceObj->deleteLater();
|
||||||
this->unlock();
|
this->unlock();
|
||||||
return;
|
return;
|
||||||
|
@ -100,7 +100,7 @@ void SessionLock::updateSurfaces(SessionLock* old) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLock::unlock() {
|
void WlSessionLock::unlock() {
|
||||||
if (this->isLocked()) {
|
if (this->isLocked()) {
|
||||||
this->lockTarget = false;
|
this->lockTarget = false;
|
||||||
this->manager->unlock();
|
this->manager->unlock();
|
||||||
|
@ -115,17 +115,17 @@ void SessionLock::unlock() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLock::onScreensChanged() { this->updateSurfaces(); }
|
void WlSessionLock::onScreensChanged() { this->updateSurfaces(); }
|
||||||
|
|
||||||
bool SessionLock::isLocked() const {
|
bool WlSessionLock::isLocked() const {
|
||||||
return this->manager == nullptr ? this->lockTarget : this->manager->isLocked();
|
return this->manager == nullptr ? this->lockTarget : this->manager->isLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionLock::isSecure() const {
|
bool WlSessionLock::isSecure() const {
|
||||||
return this->manager != nullptr && SessionLockManager::isSecure();
|
return this->manager != nullptr && SessionLockManager::isSecure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLock::setLocked(bool locked) {
|
void WlSessionLock::setLocked(bool locked) {
|
||||||
if (this->isLocked() == locked) return;
|
if (this->isLocked() == locked) return;
|
||||||
this->lockTarget = locked;
|
this->lockTarget = locked;
|
||||||
|
|
||||||
|
@ -143,9 +143,9 @@ void SessionLock::setLocked(bool locked) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlComponent* SessionLock::surfaceComponent() const { return this->mSurfaceComponent; }
|
QQmlComponent* WlSessionLock::surfaceComponent() const { return this->mSurfaceComponent; }
|
||||||
|
|
||||||
void SessionLock::setSurfaceComponent(QQmlComponent* surfaceComponent) {
|
void WlSessionLock::setSurfaceComponent(QQmlComponent* surfaceComponent) {
|
||||||
if (this->mSurfaceComponent != nullptr) this->mSurfaceComponent->deleteLater();
|
if (this->mSurfaceComponent != nullptr) this->mSurfaceComponent->deleteLater();
|
||||||
if (surfaceComponent != nullptr) surfaceComponent->setParent(this);
|
if (surfaceComponent != nullptr) surfaceComponent->setParent(this);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ void SessionLock::setSurfaceComponent(QQmlComponent* surfaceComponent) {
|
||||||
emit this->surfaceComponentChanged();
|
emit this->surfaceComponentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionLockSurface::SessionLockSurface(QObject* parent)
|
WlSessionLockSurface::WlSessionLockSurface(QObject* parent)
|
||||||
: Reloadable(parent)
|
: Reloadable(parent)
|
||||||
, mContentItem(new QQuickItem())
|
, mContentItem(new QQuickItem())
|
||||||
, ext(new LockWindowExtension(this)) {
|
, ext(new LockWindowExtension(this)) {
|
||||||
|
@ -161,19 +161,19 @@ SessionLockSurface::SessionLockSurface(QObject* parent)
|
||||||
this->mContentItem->setParent(this);
|
this->mContentItem->setParent(this);
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
QObject::connect(this, &SessionLockSurface::widthChanged, this, &SessionLockSurface::onWidthChanged);
|
QObject::connect(this, &WlSessionLockSurface::widthChanged, this, &WlSessionLockSurface::onWidthChanged);
|
||||||
QObject::connect(this, &SessionLockSurface::heightChanged, this, &SessionLockSurface::onHeightChanged);
|
QObject::connect(this, &WlSessionLockSurface::heightChanged, this, &WlSessionLockSurface::onHeightChanged);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionLockSurface::~SessionLockSurface() {
|
WlSessionLockSurface::~WlSessionLockSurface() {
|
||||||
if (this->window != nullptr) {
|
if (this->window != nullptr) {
|
||||||
this->window->deleteLater();
|
this->window->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLockSurface::onReload(QObject* oldInstance) {
|
void WlSessionLockSurface::onReload(QObject* oldInstance) {
|
||||||
if (auto* old = qobject_cast<SessionLockSurface*>(oldInstance)) {
|
if (auto* old = qobject_cast<WlSessionLockSurface*>(oldInstance)) {
|
||||||
this->window = old->disownWindow();
|
this->window = old->disownWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,25 +190,25 @@ void SessionLockSurface::onReload(QObject* oldInstance) {
|
||||||
this->window->setColor(this->mColor);
|
this->window->setColor(this->mColor);
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
QObject::connect(this->window, &QWindow::visibilityChanged, this, &SessionLockSurface::visibleChanged);
|
QObject::connect(this->window, &QWindow::visibilityChanged, this, &WlSessionLockSurface::visibleChanged);
|
||||||
QObject::connect(this->window, &QWindow::widthChanged, this, &SessionLockSurface::widthChanged);
|
QObject::connect(this->window, &QWindow::widthChanged, this, &WlSessionLockSurface::widthChanged);
|
||||||
QObject::connect(this->window, &QWindow::heightChanged, this, &SessionLockSurface::heightChanged);
|
QObject::connect(this->window, &QWindow::heightChanged, this, &WlSessionLockSurface::heightChanged);
|
||||||
QObject::connect(this->window, &QWindow::screenChanged, this, &SessionLockSurface::screenChanged);
|
QObject::connect(this->window, &QWindow::screenChanged, this, &WlSessionLockSurface::screenChanged);
|
||||||
QObject::connect(this->window, &QQuickWindow::colorChanged, this, &SessionLockSurface::colorChanged);
|
QObject::connect(this->window, &QQuickWindow::colorChanged, this, &WlSessionLockSurface::colorChanged);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
if (auto* parent = qobject_cast<SessionLock*>(this->parent())) {
|
if (auto* parent = qobject_cast<WlSessionLock*>(this->parent())) {
|
||||||
if (!this->ext->attach(this->window, parent->manager)) {
|
if (!this->ext->attach(this->window, parent->manager)) {
|
||||||
qWarning(
|
qWarning(
|
||||||
) << "Failed to attach LockWindowExtension to window. Surface will not behave correctly.";
|
) << "Failed to attach LockWindowExtension to window. Surface will not behave correctly.";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning(
|
qWarning(
|
||||||
) << "SessionLockSurface parent is not a SessionLock. Surface will not behave correctly.";
|
) << "WlSessionLockSurface parent is not a WlSessionLock. Surface will not behave correctly.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickWindow* SessionLockSurface::disownWindow() {
|
QQuickWindow* WlSessionLockSurface::disownWindow() {
|
||||||
QObject::disconnect(this->window, nullptr, this, nullptr);
|
QObject::disconnect(this->window, nullptr, this, nullptr);
|
||||||
this->mContentItem->setParentItem(nullptr);
|
this->mContentItem->setParentItem(nullptr);
|
||||||
|
|
||||||
|
@ -217,23 +217,23 @@ QQuickWindow* SessionLockSurface::disownWindow() {
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLockSurface::show() { this->ext->setVisible(); }
|
void WlSessionLockSurface::show() { this->ext->setVisible(); }
|
||||||
|
|
||||||
QQuickItem* SessionLockSurface::contentItem() const { return this->mContentItem; }
|
QQuickItem* WlSessionLockSurface::contentItem() const { return this->mContentItem; }
|
||||||
|
|
||||||
bool SessionLockSurface::isVisible() const { return this->window->isVisible(); }
|
bool WlSessionLockSurface::isVisible() const { return this->window->isVisible(); }
|
||||||
|
|
||||||
qint32 SessionLockSurface::width() const {
|
qint32 WlSessionLockSurface::width() const {
|
||||||
if (this->window == nullptr) return 0;
|
if (this->window == nullptr) return 0;
|
||||||
else return this->window->width();
|
else return this->window->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 SessionLockSurface::height() const {
|
qint32 WlSessionLockSurface::height() const {
|
||||||
if (this->window == nullptr) return 0;
|
if (this->window == nullptr) return 0;
|
||||||
else return this->window->height();
|
else return this->window->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickshellScreenInfo* SessionLockSurface::screen() const {
|
QuickshellScreenInfo* WlSessionLockSurface::screen() const {
|
||||||
QScreen* qscreen = nullptr;
|
QScreen* qscreen = nullptr;
|
||||||
|
|
||||||
if (this->window == nullptr) {
|
if (this->window == nullptr) {
|
||||||
|
@ -243,18 +243,18 @@ QuickshellScreenInfo* SessionLockSurface::screen() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new QuickshellScreenInfo(
|
return new QuickshellScreenInfo(
|
||||||
const_cast<SessionLockSurface*>(this), // NOLINT
|
const_cast<WlSessionLockSurface*>(this), // NOLINT
|
||||||
qscreen
|
qscreen
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLockSurface::setScreen(QScreen* qscreen) {
|
void WlSessionLockSurface::setScreen(QScreen* qscreen) {
|
||||||
if (this->mScreen != nullptr) {
|
if (this->mScreen != nullptr) {
|
||||||
QObject::disconnect(this->mScreen, nullptr, this, nullptr);
|
QObject::disconnect(this->mScreen, nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qscreen != nullptr) {
|
if (qscreen != nullptr) {
|
||||||
QObject::connect(qscreen, &QObject::destroyed, this, &SessionLockSurface::onScreenDestroyed);
|
QObject::connect(qscreen, &QObject::destroyed, this, &WlSessionLockSurface::onScreenDestroyed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->window == nullptr) {
|
if (this->window == nullptr) {
|
||||||
|
@ -263,23 +263,23 @@ void SessionLockSurface::setScreen(QScreen* qscreen) {
|
||||||
} else this->window->setScreen(qscreen);
|
} else this->window->setScreen(qscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLockSurface::onScreenDestroyed() { this->mScreen = nullptr; }
|
void WlSessionLockSurface::onScreenDestroyed() { this->mScreen = nullptr; }
|
||||||
|
|
||||||
QColor SessionLockSurface::color() const {
|
QColor WlSessionLockSurface::color() const {
|
||||||
if (this->window == nullptr) return this->mColor;
|
if (this->window == nullptr) return this->mColor;
|
||||||
else return this->window->color();
|
else return this->window->color();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLockSurface::setColor(QColor color) {
|
void WlSessionLockSurface::setColor(QColor color) {
|
||||||
if (this->window == nullptr) {
|
if (this->window == nullptr) {
|
||||||
this->mColor = color;
|
this->mColor = color;
|
||||||
emit this->colorChanged();
|
emit this->colorChanged();
|
||||||
} else this->window->setColor(color);
|
} else this->window->setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlListProperty<QObject> SessionLockSurface::data() {
|
QQmlListProperty<QObject> WlSessionLockSurface::data() {
|
||||||
return this->mContentItem->property("data").value<QQmlListProperty<QObject>>();
|
return this->mContentItem->property("data").value<QQmlListProperty<QObject>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLockSurface::onWidthChanged() { this->mContentItem->setWidth(this->width()); }
|
void WlSessionLockSurface::onWidthChanged() { this->mContentItem->setWidth(this->width()); }
|
||||||
void SessionLockSurface::onHeightChanged() { this->mContentItem->setHeight(this->height()); }
|
void WlSessionLockSurface::onHeightChanged() { this->mContentItem->setHeight(this->height()); }
|
||||||
|
|
|
@ -19,21 +19,21 @@
|
||||||
#include "../core/reload.hpp"
|
#include "../core/reload.hpp"
|
||||||
#include "session_lock/session_lock.hpp"
|
#include "session_lock/session_lock.hpp"
|
||||||
|
|
||||||
class SessionLockSurface;
|
class WlSessionLockSurface;
|
||||||
|
|
||||||
///! Wayland session locker.
|
///! Wayland session locker.
|
||||||
/// Wayland session lock implemented using the [ext_session_lock_v1] protocol.
|
/// Wayland session lock implemented using the [ext_session_lock_v1] protocol.
|
||||||
///
|
///
|
||||||
/// SessionLock will create an instance of its `surface` component for every screen when
|
/// WlSessionLock will create an instance of its `surface` component for every screen when
|
||||||
/// `locked` is set to true. The `surface` component must create a [SessionLockSurface]
|
/// `locked` is set to true. The `surface` component must create a [WlSessionLockSurface]
|
||||||
/// which will be displayed on each screen.
|
/// which will be displayed on each screen.
|
||||||
///
|
///
|
||||||
/// The below example will create a session lock that disappears when the button is clicked.
|
/// The below example will create a session lock that disappears when the button is clicked.
|
||||||
/// ```qml
|
/// ```qml
|
||||||
/// SessionLock {
|
/// WlSessionLock {
|
||||||
/// id: lock
|
/// id: lock
|
||||||
///
|
///
|
||||||
/// SessionLockSurface {
|
/// WlSessionLockSurface {
|
||||||
/// Button {
|
/// Button {
|
||||||
/// text: "unlock me"
|
/// text: "unlock me"
|
||||||
/// onClicked: lock.locked = false
|
/// onClicked: lock.locked = false
|
||||||
|
@ -45,7 +45,7 @@ class SessionLockSurface;
|
||||||
/// lock.locked = true
|
/// lock.locked = true
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// > [!WARNING] If the SessionLock is destroyed or quickshell exits without setting `locked`
|
/// > [!WARNING] If the WlSessionLock is destroyed or quickshell exits without setting `locked`
|
||||||
/// > to false, conformant compositors will leave the screen locked and painted with a solid
|
/// > to false, conformant compositors will leave the screen locked and painted with a solid
|
||||||
/// > color.
|
/// > color.
|
||||||
/// >
|
/// >
|
||||||
|
@ -53,29 +53,29 @@ class SessionLockSurface;
|
||||||
/// > but it will render it inoperable.
|
/// > but it will render it inoperable.
|
||||||
///
|
///
|
||||||
/// [ext_session_lock_v1]: https://wayland.app/protocols/ext-session-lock-v1
|
/// [ext_session_lock_v1]: https://wayland.app/protocols/ext-session-lock-v1
|
||||||
/// [SessionLockSurface]: ../sessionlocksurface
|
/// [WlSessionLockSurface]: ../wlsessionlocksurface
|
||||||
class SessionLock: public Reloadable {
|
class WlSessionLock: public Reloadable {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
/// Controls the lock state.
|
/// Controls the lock state.
|
||||||
///
|
///
|
||||||
/// > [!WARNING] Only one SessionLock may be locked at a time. Attempting to enable a lock while
|
/// > [!WARNING] Only one WlSessionLock may be locked at a time. Attempting to enable a lock while
|
||||||
/// > another lock is enabled will do nothing.
|
/// > another lock is enabled will do nothing.
|
||||||
Q_PROPERTY(bool locked READ isLocked WRITE setLocked NOTIFY lockStateChanged);
|
Q_PROPERTY(bool locked READ isLocked WRITE setLocked NOTIFY lockStateChanged);
|
||||||
/// The compositor lock state.
|
/// The compositor lock state.
|
||||||
///
|
///
|
||||||
/// This is set to true once the compositor has confirmed all screens are covered with locks.
|
/// This is set to true once the compositor has confirmed all screens are covered with locks.
|
||||||
Q_PROPERTY(bool secure READ isSecure NOTIFY secureStateChanged);
|
Q_PROPERTY(bool secure READ isSecure NOTIFY secureStateChanged);
|
||||||
/// The surface that will be created for each screen. Must create a [SessionLockSurface].
|
/// The surface that will be created for each screen. Must create a [WlSessionLockSurface].
|
||||||
///
|
///
|
||||||
/// [SessionLockSurface]: ../sessionlocksurface
|
/// [WlSessionLockSurface]: ../wlsessionlocksurface
|
||||||
Q_PROPERTY(QQmlComponent* surface READ surfaceComponent WRITE setSurfaceComponent NOTIFY surfaceComponentChanged);
|
Q_PROPERTY(QQmlComponent* surface READ surfaceComponent WRITE setSurfaceComponent NOTIFY surfaceComponentChanged);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
QML_ELEMENT;
|
QML_ELEMENT;
|
||||||
Q_CLASSINFO("DefaultProperty", "surface");
|
Q_CLASSINFO("DefaultProperty", "surface");
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SessionLock(QObject* parent = nullptr): Reloadable(parent) {}
|
explicit WlSessionLock(QObject* parent = nullptr): Reloadable(parent) {}
|
||||||
|
|
||||||
void onReload(QObject* oldInstance) override;
|
void onReload(QObject* oldInstance) override;
|
||||||
|
|
||||||
|
@ -97,21 +97,21 @@ private slots:
|
||||||
void onScreensChanged();
|
void onScreensChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateSurfaces(SessionLock* old = nullptr);
|
void updateSurfaces(WlSessionLock* old = nullptr);
|
||||||
|
|
||||||
SessionLockManager* manager = nullptr;
|
SessionLockManager* manager = nullptr;
|
||||||
QQmlComponent* mSurfaceComponent = nullptr;
|
QQmlComponent* mSurfaceComponent = nullptr;
|
||||||
QMap<QScreen*, SessionLockSurface*> surfaces;
|
QMap<QScreen*, WlSessionLockSurface*> surfaces;
|
||||||
bool lockTarget = false;
|
bool lockTarget = false;
|
||||||
|
|
||||||
friend class SessionLockSurface;
|
friend class WlSessionLockSurface;
|
||||||
};
|
};
|
||||||
|
|
||||||
///! Surface to display with a `SessionLock`.
|
///! Surface to display with a `WlSessionLock`.
|
||||||
/// Surface displayed by a [SessionLock] when it is locked.
|
/// Surface displayed by a [WlSessionLock] when it is locked.
|
||||||
///
|
///
|
||||||
/// [SessionLock]: ../sessionlock
|
/// [WlSessionLock]: ../wlsessionlock
|
||||||
class SessionLockSurface: public Reloadable {
|
class WlSessionLockSurface: public Reloadable {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
Q_PROPERTY(QQuickItem* contentItem READ contentItem);
|
Q_PROPERTY(QQuickItem* contentItem READ contentItem);
|
||||||
|
@ -142,13 +142,13 @@ class SessionLockSurface: public Reloadable {
|
||||||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged);
|
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged);
|
||||||
Q_PROPERTY(QQmlListProperty<QObject> data READ data);
|
Q_PROPERTY(QQmlListProperty<QObject> data READ data);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
QML_ELEMENT;
|
QML_NAMED_ELEMENT(WlSessionLockSurface);
|
||||||
Q_CLASSINFO("DefaultProperty", "data");
|
Q_CLASSINFO("DefaultProperty", "data");
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SessionLockSurface(QObject* parent = nullptr);
|
explicit WlSessionLockSurface(QObject* parent = nullptr);
|
||||||
~SessionLockSurface() override;
|
~WlSessionLockSurface() override;
|
||||||
Q_DISABLE_COPY_MOVE(SessionLockSurface);
|
Q_DISABLE_COPY_MOVE(WlSessionLockSurface);
|
||||||
|
|
||||||
void onReload(QObject* oldInstance) override;
|
void onReload(QObject* oldInstance) override;
|
||||||
QQuickWindow* disownWindow();
|
QQuickWindow* disownWindow();
|
||||||
|
|
|
@ -89,8 +89,8 @@ void WlrLayershell::setScreen(QuickshellScreenInfo* screen) {
|
||||||
type WlrLayershell::get() const { return this->ext->get(); } \
|
type WlrLayershell::get() const { return this->ext->get(); } \
|
||||||
void WlrLayershell::set(type value) { this->ext->set(value); }
|
void WlrLayershell::set(type value) { this->ext->set(value); }
|
||||||
|
|
||||||
extPair(Layer::Enum, layer, setLayer);
|
extPair(WlrLayer::Enum, layer, setLayer);
|
||||||
extPair(KeyboardFocus::Enum, keyboardFocus, setKeyboardFocus);
|
extPair(WlrKeyboardFocus::Enum, keyboardFocus, setKeyboardFocus);
|
||||||
extPair(Margins, margins, setMargins);
|
extPair(Margins, margins, setMargins);
|
||||||
// NOLINTEND
|
// NOLINTEND
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
/// ```qml
|
/// ```qml
|
||||||
/// PanelWindow {
|
/// PanelWindow {
|
||||||
/// // When PanelWindow is backed with WlrLayershell this will work
|
/// // When PanelWindow is backed with WlrLayershell this will work
|
||||||
/// WlrLayershell.layer: Layer.Bottom
|
/// WlrLayershell.layer: WlrLayer.Bottom
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
/// PanelWindow {
|
/// PanelWindow {
|
||||||
/// Component.onCompleted: {
|
/// Component.onCompleted: {
|
||||||
/// if (this.WlrLayershell != null) {
|
/// if (this.WlrLayershell != null) {
|
||||||
/// this.WlrLayershell.layer = Layer.Bottom;
|
/// this.WlrLayershell.layer = WlrLayer.Bottom;
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
|
@ -41,14 +41,14 @@ class WlrLayershell: public ProxyWindowBase {
|
||||||
QSDOC_BASECLASS(PanelWindowInterface);
|
QSDOC_BASECLASS(PanelWindowInterface);
|
||||||
// clang-format off
|
// clang-format off
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
/// The shell layer the window sits in. Defaults to `Layer.Top`.
|
/// The shell layer the window sits in. Defaults to `WlrLayer.Top`.
|
||||||
Q_PROPERTY(Layer::Enum layer READ layer WRITE setLayer NOTIFY layerChanged);
|
Q_PROPERTY(WlrLayer::Enum layer READ layer WRITE setLayer NOTIFY layerChanged);
|
||||||
/// Similar to the class property of windows. Can be used to identify the window to external tools.
|
/// Similar to the class property of windows. Can be used to identify the window to external tools.
|
||||||
///
|
///
|
||||||
/// Cannot be set after windowConnected.
|
/// Cannot be set after windowConnected.
|
||||||
Q_PROPERTY(QString namespace READ ns WRITE setNamespace NOTIFY namespaceChanged);
|
Q_PROPERTY(QString namespace READ ns WRITE setNamespace NOTIFY namespaceChanged);
|
||||||
/// The degree of keyboard focus taken. Defaults to `KeyboardFocus.None`.
|
/// The degree of keyboard focus taken. Defaults to `KeyboardFocus.None`.
|
||||||
Q_PROPERTY(KeyboardFocus::Enum keyboardFocus READ keyboardFocus WRITE setKeyboardFocus NOTIFY keyboardFocusChanged);
|
Q_PROPERTY(WlrKeyboardFocus::Enum keyboardFocus READ keyboardFocus WRITE setKeyboardFocus NOTIFY keyboardFocusChanged);
|
||||||
|
|
||||||
QSDOC_HIDE Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged);
|
QSDOC_HIDE Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged);
|
||||||
QSDOC_HIDE Q_PROPERTY(qint32 exclusiveZone READ exclusiveZone WRITE setExclusiveZone NOTIFY exclusiveZoneChanged);
|
QSDOC_HIDE Q_PROPERTY(qint32 exclusiveZone READ exclusiveZone WRITE setExclusiveZone NOTIFY exclusiveZoneChanged);
|
||||||
|
@ -69,14 +69,14 @@ public:
|
||||||
|
|
||||||
void setScreen(QuickshellScreenInfo* screen) override;
|
void setScreen(QuickshellScreenInfo* screen) override;
|
||||||
|
|
||||||
[[nodiscard]] Layer::Enum layer() const;
|
[[nodiscard]] WlrLayer::Enum layer() const;
|
||||||
void setLayer(Layer::Enum layer); // NOLINT
|
void setLayer(WlrLayer::Enum layer); // NOLINT
|
||||||
|
|
||||||
[[nodiscard]] QString ns() const;
|
[[nodiscard]] QString ns() const;
|
||||||
void setNamespace(QString ns);
|
void setNamespace(QString ns);
|
||||||
|
|
||||||
[[nodiscard]] KeyboardFocus::Enum keyboardFocus() const;
|
[[nodiscard]] WlrKeyboardFocus::Enum keyboardFocus() const;
|
||||||
void setKeyboardFocus(KeyboardFocus::Enum focus); // NOLINT
|
void setKeyboardFocus(WlrKeyboardFocus::Enum focus); // NOLINT
|
||||||
|
|
||||||
[[nodiscard]] Anchors anchors() const;
|
[[nodiscard]] Anchors anchors() const;
|
||||||
void setAnchors(Anchors anchors);
|
void setAnchors(Anchors anchors);
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
#include "window.hpp"
|
#include "window.hpp"
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
[[nodiscard]] QtWayland::zwlr_layer_shell_v1::layer toWaylandLayer(const Layer::Enum& layer) noexcept;
|
[[nodiscard]] QtWayland::zwlr_layer_shell_v1::layer toWaylandLayer(const WlrLayer::Enum& layer) noexcept;
|
||||||
[[nodiscard]] QtWayland::zwlr_layer_surface_v1::anchor toWaylandAnchors(const Anchors& anchors) noexcept;
|
[[nodiscard]] QtWayland::zwlr_layer_surface_v1::anchor toWaylandAnchors(const Anchors& anchors) noexcept;
|
||||||
[[nodiscard]] QtWayland::zwlr_layer_surface_v1::keyboard_interactivity toWaylandKeyboardFocus(const KeyboardFocus::Enum& focus) noexcept;
|
[[nodiscard]] QtWayland::zwlr_layer_surface_v1::keyboard_interactivity toWaylandKeyboardFocus(const WlrKeyboardFocus::Enum& focus) noexcept;
|
||||||
[[nodiscard]] QSize constrainedSize(const Anchors& anchors, const QSize& size) noexcept;
|
[[nodiscard]] QSize constrainedSize(const Anchors& anchors, const QSize& size) noexcept;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
@ -127,12 +127,12 @@ void QSWaylandLayerSurface::updateKeyboardFocus() {
|
||||||
this->set_keyboard_interactivity(toWaylandKeyboardFocus(this->ext->mKeyboardFocus));
|
this->set_keyboard_interactivity(toWaylandKeyboardFocus(this->ext->mKeyboardFocus));
|
||||||
}
|
}
|
||||||
|
|
||||||
QtWayland::zwlr_layer_shell_v1::layer toWaylandLayer(const Layer::Enum& layer) noexcept {
|
QtWayland::zwlr_layer_shell_v1::layer toWaylandLayer(const WlrLayer::Enum& layer) noexcept {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case Layer::Background: return QtWayland::zwlr_layer_shell_v1::layer_background;
|
case WlrLayer::Background: return QtWayland::zwlr_layer_shell_v1::layer_background;
|
||||||
case Layer::Bottom: return QtWayland::zwlr_layer_shell_v1::layer_bottom;
|
case WlrLayer::Bottom: return QtWayland::zwlr_layer_shell_v1::layer_bottom;
|
||||||
case Layer::Top: return QtWayland::zwlr_layer_shell_v1::layer_top;
|
case WlrLayer::Top: return QtWayland::zwlr_layer_shell_v1::layer_top;
|
||||||
case Layer::Overlay: return QtWayland::zwlr_layer_shell_v1::layer_overlay;
|
case WlrLayer::Overlay: return QtWayland::zwlr_layer_shell_v1::layer_overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QtWayland::zwlr_layer_shell_v1::layer_top;
|
return QtWayland::zwlr_layer_shell_v1::layer_top;
|
||||||
|
@ -148,12 +148,12 @@ QtWayland::zwlr_layer_surface_v1::anchor toWaylandAnchors(const Anchors& anchors
|
||||||
}
|
}
|
||||||
|
|
||||||
QtWayland::zwlr_layer_surface_v1::keyboard_interactivity
|
QtWayland::zwlr_layer_surface_v1::keyboard_interactivity
|
||||||
toWaylandKeyboardFocus(const KeyboardFocus::Enum& focus) noexcept {
|
toWaylandKeyboardFocus(const WlrKeyboardFocus::Enum& focus) noexcept {
|
||||||
switch (focus) {
|
switch (focus) {
|
||||||
case KeyboardFocus::None: return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_none;
|
case WlrKeyboardFocus::None: return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_none;
|
||||||
case KeyboardFocus::Exclusive:
|
case WlrKeyboardFocus::Exclusive:
|
||||||
return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_exclusive;
|
return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_exclusive;
|
||||||
case KeyboardFocus::OnDemand:
|
case WlrKeyboardFocus::OnDemand:
|
||||||
return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_on_demand;
|
return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_on_demand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ void LayershellWindowExtension::setExclusiveZone(qint32 exclusiveZone) {
|
||||||
|
|
||||||
qint32 LayershellWindowExtension::exclusiveZone() const { return this->mExclusiveZone; }
|
qint32 LayershellWindowExtension::exclusiveZone() const { return this->mExclusiveZone; }
|
||||||
|
|
||||||
void LayershellWindowExtension::setLayer(Layer::Enum layer) {
|
void LayershellWindowExtension::setLayer(WlrLayer::Enum layer) {
|
||||||
if (layer != this->mLayer) {
|
if (layer != this->mLayer) {
|
||||||
this->mLayer = layer;
|
this->mLayer = layer;
|
||||||
if (this->surface != nullptr) this->surface->updateLayer();
|
if (this->surface != nullptr) this->surface->updateLayer();
|
||||||
|
@ -121,9 +121,9 @@ void LayershellWindowExtension::setLayer(Layer::Enum layer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer::Enum LayershellWindowExtension::layer() const { return this->mLayer; }
|
WlrLayer::Enum LayershellWindowExtension::layer() const { return this->mLayer; }
|
||||||
|
|
||||||
void LayershellWindowExtension::setKeyboardFocus(KeyboardFocus::Enum focus) {
|
void LayershellWindowExtension::setKeyboardFocus(WlrKeyboardFocus::Enum focus) {
|
||||||
if (focus != this->mKeyboardFocus) {
|
if (focus != this->mKeyboardFocus) {
|
||||||
this->mKeyboardFocus = focus;
|
this->mKeyboardFocus = focus;
|
||||||
if (this->surface != nullptr) this->surface->updateKeyboardFocus();
|
if (this->surface != nullptr) this->surface->updateKeyboardFocus();
|
||||||
|
@ -131,7 +131,7 @@ void LayershellWindowExtension::setKeyboardFocus(KeyboardFocus::Enum focus) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardFocus::Enum LayershellWindowExtension::keyboardFocus() const {
|
WlrKeyboardFocus::Enum LayershellWindowExtension::keyboardFocus() const {
|
||||||
return this->mKeyboardFocus;
|
return this->mKeyboardFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "../../core/panelinterface.hpp"
|
#include "../../core/panelinterface.hpp"
|
||||||
|
|
||||||
///! WlrLayershell layer
|
///! WlrLayershell layer
|
||||||
namespace Layer { // NOLINT
|
namespace WlrLayer { // NOLINT
|
||||||
Q_NAMESPACE;
|
Q_NAMESPACE;
|
||||||
QML_ELEMENT;
|
QML_ELEMENT;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ Q_ENUM_NS(Enum);
|
||||||
} // namespace Layer
|
} // namespace Layer
|
||||||
|
|
||||||
///! WlrLayershell keyboard focus mode
|
///! WlrLayershell keyboard focus mode
|
||||||
namespace KeyboardFocus { // NOLINT
|
namespace WlrKeyboardFocus { // NOLINT
|
||||||
Q_NAMESPACE;
|
Q_NAMESPACE;
|
||||||
QML_ELEMENT;
|
QML_ELEMENT;
|
||||||
|
|
||||||
|
@ -74,11 +74,11 @@ public:
|
||||||
void setExclusiveZone(qint32 exclusiveZone);
|
void setExclusiveZone(qint32 exclusiveZone);
|
||||||
[[nodiscard]] qint32 exclusiveZone() const;
|
[[nodiscard]] qint32 exclusiveZone() const;
|
||||||
|
|
||||||
void setLayer(Layer::Enum layer);
|
void setLayer(WlrLayer::Enum layer);
|
||||||
[[nodiscard]] Layer::Enum layer() const;
|
[[nodiscard]] WlrLayer::Enum layer() const;
|
||||||
|
|
||||||
void setKeyboardFocus(KeyboardFocus::Enum focus);
|
void setKeyboardFocus(WlrKeyboardFocus::Enum focus);
|
||||||
[[nodiscard]] KeyboardFocus::Enum keyboardFocus() const;
|
[[nodiscard]] WlrKeyboardFocus::Enum keyboardFocus() const;
|
||||||
|
|
||||||
// no effect if configured
|
// no effect if configured
|
||||||
void setUseWindowScreen(bool value);
|
void setUseWindowScreen(bool value);
|
||||||
|
@ -101,9 +101,9 @@ private:
|
||||||
Anchors mAnchors;
|
Anchors mAnchors;
|
||||||
Margins mMargins;
|
Margins mMargins;
|
||||||
qint32 mExclusiveZone = 0;
|
qint32 mExclusiveZone = 0;
|
||||||
Layer::Enum mLayer = Layer::Top;
|
WlrLayer::Enum mLayer = WlrLayer::Top;
|
||||||
QString mNamespace = "quickshell";
|
QString mNamespace = "quickshell";
|
||||||
KeyboardFocus::Enum mKeyboardFocus = KeyboardFocus::None;
|
WlrKeyboardFocus::Enum mKeyboardFocus = WlrKeyboardFocus::None;
|
||||||
|
|
||||||
friend class QSWaylandLayerSurface;
|
friend class QSWaylandLayerSurface;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue