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 "session_lock/session_lock.hpp"
|
||||
|
||||
void SessionLock::onReload(QObject* oldInstance) {
|
||||
auto* old = qobject_cast<SessionLock*>(oldInstance);
|
||||
void WlSessionLock::onReload(QObject* oldInstance) {
|
||||
auto* old = qobject_cast<WlSessionLock*>(oldInstance);
|
||||
|
||||
if (old != nullptr) {
|
||||
QObject::disconnect(old->manager, nullptr, old, nullptr);
|
||||
|
@ -30,18 +30,18 @@ void SessionLock::onReload(QObject* oldInstance) {
|
|||
}
|
||||
|
||||
// clang-format off
|
||||
QObject::connect(this->manager, &SessionLockManager::locked, this, &SessionLock::secureStateChanged);
|
||||
QObject::connect(this->manager, &SessionLockManager::unlocked, this, &SessionLock::secureStateChanged);
|
||||
QObject::connect(this->manager, &SessionLockManager::locked, this, &WlSessionLock::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* guiApp = qobject_cast<QGuiApplication*>(app);
|
||||
|
||||
if (guiApp != nullptr) {
|
||||
QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &SessionLock::onScreensChanged);
|
||||
QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &SessionLock::onScreensChanged);
|
||||
QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &SessionLock::onScreensChanged);
|
||||
QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &WlSessionLock::onScreensChanged);
|
||||
QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &WlSessionLock::onScreensChanged);
|
||||
QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &WlSessionLock::onScreensChanged);
|
||||
}
|
||||
// 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()) {
|
||||
auto screens = QGuiApplication::screens();
|
||||
|
||||
|
@ -66,7 +66,7 @@ void SessionLock::updateSurfaces(SessionLock* old) {
|
|||
}
|
||||
|
||||
if (this->mSurfaceComponent == nullptr) {
|
||||
qWarning() << "SessionLock.surface is null. Aborting lock.";
|
||||
qWarning() << "WlSessionLock.surface is null. Aborting lock.";
|
||||
this->unlock();
|
||||
return;
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ void SessionLock::updateSurfaces(SessionLock* old) {
|
|||
if (!this->surfaces.contains(screen)) {
|
||||
auto* instanceObj =
|
||||
this->mSurfaceComponent->create(QQmlEngine::contextForObject(this->mSurfaceComponent));
|
||||
auto* instance = qobject_cast<SessionLockSurface*>(instanceObj);
|
||||
auto* instance = qobject_cast<WlSessionLockSurface*>(instanceObj);
|
||||
|
||||
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();
|
||||
this->unlock();
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ void SessionLock::updateSurfaces(SessionLock* old) {
|
|||
}
|
||||
}
|
||||
|
||||
void SessionLock::unlock() {
|
||||
void WlSessionLock::unlock() {
|
||||
if (this->isLocked()) {
|
||||
this->lockTarget = false;
|
||||
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();
|
||||
}
|
||||
|
||||
bool SessionLock::isSecure() const {
|
||||
bool WlSessionLock::isSecure() const {
|
||||
return this->manager != nullptr && SessionLockManager::isSecure();
|
||||
}
|
||||
|
||||
void SessionLock::setLocked(bool locked) {
|
||||
void WlSessionLock::setLocked(bool locked) {
|
||||
if (this->isLocked() == locked) return;
|
||||
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 (surfaceComponent != nullptr) surfaceComponent->setParent(this);
|
||||
|
||||
|
@ -153,7 +153,7 @@ void SessionLock::setSurfaceComponent(QQmlComponent* surfaceComponent) {
|
|||
emit this->surfaceComponentChanged();
|
||||
}
|
||||
|
||||
SessionLockSurface::SessionLockSurface(QObject* parent)
|
||||
WlSessionLockSurface::WlSessionLockSurface(QObject* parent)
|
||||
: Reloadable(parent)
|
||||
, mContentItem(new QQuickItem())
|
||||
, ext(new LockWindowExtension(this)) {
|
||||
|
@ -161,19 +161,19 @@ SessionLockSurface::SessionLockSurface(QObject* parent)
|
|||
this->mContentItem->setParent(this);
|
||||
|
||||
// clang-format off
|
||||
QObject::connect(this, &SessionLockSurface::widthChanged, this, &SessionLockSurface::onWidthChanged);
|
||||
QObject::connect(this, &SessionLockSurface::heightChanged, this, &SessionLockSurface::onHeightChanged);
|
||||
QObject::connect(this, &WlSessionLockSurface::widthChanged, this, &WlSessionLockSurface::onWidthChanged);
|
||||
QObject::connect(this, &WlSessionLockSurface::heightChanged, this, &WlSessionLockSurface::onHeightChanged);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
SessionLockSurface::~SessionLockSurface() {
|
||||
WlSessionLockSurface::~WlSessionLockSurface() {
|
||||
if (this->window != nullptr) {
|
||||
this->window->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
void SessionLockSurface::onReload(QObject* oldInstance) {
|
||||
if (auto* old = qobject_cast<SessionLockSurface*>(oldInstance)) {
|
||||
void WlSessionLockSurface::onReload(QObject* oldInstance) {
|
||||
if (auto* old = qobject_cast<WlSessionLockSurface*>(oldInstance)) {
|
||||
this->window = old->disownWindow();
|
||||
}
|
||||
|
||||
|
@ -190,25 +190,25 @@ void SessionLockSurface::onReload(QObject* oldInstance) {
|
|||
this->window->setColor(this->mColor);
|
||||
|
||||
// clang-format off
|
||||
QObject::connect(this->window, &QWindow::visibilityChanged, this, &SessionLockSurface::visibleChanged);
|
||||
QObject::connect(this->window, &QWindow::widthChanged, this, &SessionLockSurface::widthChanged);
|
||||
QObject::connect(this->window, &QWindow::heightChanged, this, &SessionLockSurface::heightChanged);
|
||||
QObject::connect(this->window, &QWindow::screenChanged, this, &SessionLockSurface::screenChanged);
|
||||
QObject::connect(this->window, &QQuickWindow::colorChanged, this, &SessionLockSurface::colorChanged);
|
||||
QObject::connect(this->window, &QWindow::visibilityChanged, this, &WlSessionLockSurface::visibleChanged);
|
||||
QObject::connect(this->window, &QWindow::widthChanged, this, &WlSessionLockSurface::widthChanged);
|
||||
QObject::connect(this->window, &QWindow::heightChanged, this, &WlSessionLockSurface::heightChanged);
|
||||
QObject::connect(this->window, &QWindow::screenChanged, this, &WlSessionLockSurface::screenChanged);
|
||||
QObject::connect(this->window, &QQuickWindow::colorChanged, this, &WlSessionLockSurface::colorChanged);
|
||||
// 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)) {
|
||||
qWarning(
|
||||
) << "Failed to attach LockWindowExtension to window. Surface will not behave correctly.";
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
this->mContentItem->setParentItem(nullptr);
|
||||
|
||||
|
@ -217,23 +217,23 @@ QQuickWindow* SessionLockSurface::disownWindow() {
|
|||
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;
|
||||
else return this->window->width();
|
||||
}
|
||||
|
||||
qint32 SessionLockSurface::height() const {
|
||||
qint32 WlSessionLockSurface::height() const {
|
||||
if (this->window == nullptr) return 0;
|
||||
else return this->window->height();
|
||||
}
|
||||
|
||||
QuickshellScreenInfo* SessionLockSurface::screen() const {
|
||||
QuickshellScreenInfo* WlSessionLockSurface::screen() const {
|
||||
QScreen* qscreen = nullptr;
|
||||
|
||||
if (this->window == nullptr) {
|
||||
|
@ -243,18 +243,18 @@ QuickshellScreenInfo* SessionLockSurface::screen() const {
|
|||
}
|
||||
|
||||
return new QuickshellScreenInfo(
|
||||
const_cast<SessionLockSurface*>(this), // NOLINT
|
||||
const_cast<WlSessionLockSurface*>(this), // NOLINT
|
||||
qscreen
|
||||
);
|
||||
}
|
||||
|
||||
void SessionLockSurface::setScreen(QScreen* qscreen) {
|
||||
void WlSessionLockSurface::setScreen(QScreen* qscreen) {
|
||||
if (this->mScreen != nullptr) {
|
||||
QObject::disconnect(this->mScreen, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
if (qscreen != nullptr) {
|
||||
QObject::connect(qscreen, &QObject::destroyed, this, &SessionLockSurface::onScreenDestroyed);
|
||||
QObject::connect(qscreen, &QObject::destroyed, this, &WlSessionLockSurface::onScreenDestroyed);
|
||||
}
|
||||
|
||||
if (this->window == nullptr) {
|
||||
|
@ -263,23 +263,23 @@ void SessionLockSurface::setScreen(QScreen* 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;
|
||||
else return this->window->color();
|
||||
}
|
||||
|
||||
void SessionLockSurface::setColor(QColor color) {
|
||||
void WlSessionLockSurface::setColor(QColor color) {
|
||||
if (this->window == nullptr) {
|
||||
this->mColor = color;
|
||||
emit this->colorChanged();
|
||||
} else this->window->setColor(color);
|
||||
}
|
||||
|
||||
QQmlListProperty<QObject> SessionLockSurface::data() {
|
||||
QQmlListProperty<QObject> WlSessionLockSurface::data() {
|
||||
return this->mContentItem->property("data").value<QQmlListProperty<QObject>>();
|
||||
}
|
||||
|
||||
void SessionLockSurface::onWidthChanged() { this->mContentItem->setWidth(this->width()); }
|
||||
void SessionLockSurface::onHeightChanged() { this->mContentItem->setHeight(this->height()); }
|
||||
void WlSessionLockSurface::onWidthChanged() { this->mContentItem->setWidth(this->width()); }
|
||||
void WlSessionLockSurface::onHeightChanged() { this->mContentItem->setHeight(this->height()); }
|
||||
|
|
|
@ -19,21 +19,21 @@
|
|||
#include "../core/reload.hpp"
|
||||
#include "session_lock/session_lock.hpp"
|
||||
|
||||
class SessionLockSurface;
|
||||
class WlSessionLockSurface;
|
||||
|
||||
///! Wayland session locker.
|
||||
/// Wayland session lock implemented using the [ext_session_lock_v1] protocol.
|
||||
///
|
||||
/// SessionLock will create an instance of its `surface` component for every screen when
|
||||
/// `locked` is set to true. The `surface` component must create a [SessionLockSurface]
|
||||
/// WlSessionLock will create an instance of its `surface` component for every screen when
|
||||
/// `locked` is set to true. The `surface` component must create a [WlSessionLockSurface]
|
||||
/// which will be displayed on each screen.
|
||||
///
|
||||
/// The below example will create a session lock that disappears when the button is clicked.
|
||||
/// ```qml
|
||||
/// SessionLock {
|
||||
/// WlSessionLock {
|
||||
/// id: lock
|
||||
///
|
||||
/// SessionLockSurface {
|
||||
/// WlSessionLockSurface {
|
||||
/// Button {
|
||||
/// text: "unlock me"
|
||||
/// onClicked: lock.locked = false
|
||||
|
@ -45,7 +45,7 @@ class SessionLockSurface;
|
|||
/// 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
|
||||
/// > color.
|
||||
/// >
|
||||
|
@ -53,29 +53,29 @@ class SessionLockSurface;
|
|||
/// > but it will render it inoperable.
|
||||
///
|
||||
/// [ext_session_lock_v1]: https://wayland.app/protocols/ext-session-lock-v1
|
||||
/// [SessionLockSurface]: ../sessionlocksurface
|
||||
class SessionLock: public Reloadable {
|
||||
/// [WlSessionLockSurface]: ../wlsessionlocksurface
|
||||
class WlSessionLock: public Reloadable {
|
||||
Q_OBJECT;
|
||||
// clang-format off
|
||||
/// 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.
|
||||
Q_PROPERTY(bool locked READ isLocked WRITE setLocked NOTIFY lockStateChanged);
|
||||
/// The compositor lock state.
|
||||
///
|
||||
/// This is set to true once the compositor has confirmed all screens are covered with locks.
|
||||
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);
|
||||
// clang-format on
|
||||
QML_ELEMENT;
|
||||
Q_CLASSINFO("DefaultProperty", "surface");
|
||||
|
||||
public:
|
||||
explicit SessionLock(QObject* parent = nullptr): Reloadable(parent) {}
|
||||
explicit WlSessionLock(QObject* parent = nullptr): Reloadable(parent) {}
|
||||
|
||||
void onReload(QObject* oldInstance) override;
|
||||
|
||||
|
@ -97,21 +97,21 @@ private slots:
|
|||
void onScreensChanged();
|
||||
|
||||
private:
|
||||
void updateSurfaces(SessionLock* old = nullptr);
|
||||
void updateSurfaces(WlSessionLock* old = nullptr);
|
||||
|
||||
SessionLockManager* manager = nullptr;
|
||||
QQmlComponent* mSurfaceComponent = nullptr;
|
||||
QMap<QScreen*, SessionLockSurface*> surfaces;
|
||||
QMap<QScreen*, WlSessionLockSurface*> surfaces;
|
||||
bool lockTarget = false;
|
||||
|
||||
friend class SessionLockSurface;
|
||||
friend class WlSessionLockSurface;
|
||||
};
|
||||
|
||||
///! Surface to display with a `SessionLock`.
|
||||
/// Surface displayed by a [SessionLock] when it is locked.
|
||||
///! Surface to display with a `WlSessionLock`.
|
||||
/// Surface displayed by a [WlSessionLock] when it is locked.
|
||||
///
|
||||
/// [SessionLock]: ../sessionlock
|
||||
class SessionLockSurface: public Reloadable {
|
||||
/// [WlSessionLock]: ../wlsessionlock
|
||||
class WlSessionLockSurface: public Reloadable {
|
||||
Q_OBJECT;
|
||||
// clang-format off
|
||||
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(QQmlListProperty<QObject> data READ data);
|
||||
// clang-format on
|
||||
QML_ELEMENT;
|
||||
QML_NAMED_ELEMENT(WlSessionLockSurface);
|
||||
Q_CLASSINFO("DefaultProperty", "data");
|
||||
|
||||
public:
|
||||
explicit SessionLockSurface(QObject* parent = nullptr);
|
||||
~SessionLockSurface() override;
|
||||
Q_DISABLE_COPY_MOVE(SessionLockSurface);
|
||||
explicit WlSessionLockSurface(QObject* parent = nullptr);
|
||||
~WlSessionLockSurface() override;
|
||||
Q_DISABLE_COPY_MOVE(WlSessionLockSurface);
|
||||
|
||||
void onReload(QObject* oldInstance) override;
|
||||
QQuickWindow* disownWindow();
|
||||
|
|
|
@ -89,8 +89,8 @@ void WlrLayershell::setScreen(QuickshellScreenInfo* screen) {
|
|||
type WlrLayershell::get() const { return this->ext->get(); } \
|
||||
void WlrLayershell::set(type value) { this->ext->set(value); }
|
||||
|
||||
extPair(Layer::Enum, layer, setLayer);
|
||||
extPair(KeyboardFocus::Enum, keyboardFocus, setKeyboardFocus);
|
||||
extPair(WlrLayer::Enum, layer, setLayer);
|
||||
extPair(WlrKeyboardFocus::Enum, keyboardFocus, setKeyboardFocus);
|
||||
extPair(Margins, margins, setMargins);
|
||||
// NOLINTEND
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/// ```qml
|
||||
/// PanelWindow {
|
||||
/// // When PanelWindow is backed with WlrLayershell this will work
|
||||
/// WlrLayershell.layer: Layer.Bottom
|
||||
/// WlrLayershell.layer: WlrLayer.Bottom
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
|
@ -29,7 +29,7 @@
|
|||
/// PanelWindow {
|
||||
/// Component.onCompleted: {
|
||||
/// 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);
|
||||
// clang-format off
|
||||
Q_OBJECT;
|
||||
/// The shell layer the window sits in. Defaults to `Layer.Top`.
|
||||
Q_PROPERTY(Layer::Enum layer READ layer WRITE setLayer NOTIFY layerChanged);
|
||||
/// The shell layer the window sits in. Defaults to `WlrLayer.Top`.
|
||||
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.
|
||||
///
|
||||
/// Cannot be set after windowConnected.
|
||||
Q_PROPERTY(QString namespace READ ns WRITE setNamespace NOTIFY namespaceChanged);
|
||||
/// 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(qint32 exclusiveZone READ exclusiveZone WRITE setExclusiveZone NOTIFY exclusiveZoneChanged);
|
||||
|
@ -69,14 +69,14 @@ public:
|
|||
|
||||
void setScreen(QuickshellScreenInfo* screen) override;
|
||||
|
||||
[[nodiscard]] Layer::Enum layer() const;
|
||||
void setLayer(Layer::Enum layer); // NOLINT
|
||||
[[nodiscard]] WlrLayer::Enum layer() const;
|
||||
void setLayer(WlrLayer::Enum layer); // NOLINT
|
||||
|
||||
[[nodiscard]] QString ns() const;
|
||||
void setNamespace(QString ns);
|
||||
|
||||
[[nodiscard]] KeyboardFocus::Enum keyboardFocus() const;
|
||||
void setKeyboardFocus(KeyboardFocus::Enum focus); // NOLINT
|
||||
[[nodiscard]] WlrKeyboardFocus::Enum keyboardFocus() const;
|
||||
void setKeyboardFocus(WlrKeyboardFocus::Enum focus); // NOLINT
|
||||
|
||||
[[nodiscard]] Anchors anchors() const;
|
||||
void setAnchors(Anchors anchors);
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
#include "window.hpp"
|
||||
|
||||
// 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::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;
|
||||
// clang-format on
|
||||
|
||||
|
@ -127,12 +127,12 @@ void QSWaylandLayerSurface::updateKeyboardFocus() {
|
|||
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) {
|
||||
case Layer::Background: return QtWayland::zwlr_layer_shell_v1::layer_background;
|
||||
case Layer::Bottom: return QtWayland::zwlr_layer_shell_v1::layer_bottom;
|
||||
case Layer::Top: return QtWayland::zwlr_layer_shell_v1::layer_top;
|
||||
case Layer::Overlay: return QtWayland::zwlr_layer_shell_v1::layer_overlay;
|
||||
case WlrLayer::Background: return QtWayland::zwlr_layer_shell_v1::layer_background;
|
||||
case WlrLayer::Bottom: return QtWayland::zwlr_layer_shell_v1::layer_bottom;
|
||||
case WlrLayer::Top: return QtWayland::zwlr_layer_shell_v1::layer_top;
|
||||
case WlrLayer::Overlay: return QtWayland::zwlr_layer_shell_v1::layer_overlay;
|
||||
}
|
||||
|
||||
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
|
||||
toWaylandKeyboardFocus(const KeyboardFocus::Enum& focus) noexcept {
|
||||
toWaylandKeyboardFocus(const WlrKeyboardFocus::Enum& focus) noexcept {
|
||||
switch (focus) {
|
||||
case KeyboardFocus::None: return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_none;
|
||||
case KeyboardFocus::Exclusive:
|
||||
case WlrKeyboardFocus::None: return QtWayland::zwlr_layer_surface_v1::keyboard_interactivity_none;
|
||||
case WlrKeyboardFocus::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;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ void LayershellWindowExtension::setExclusiveZone(qint32 exclusiveZone) {
|
|||
|
||||
qint32 LayershellWindowExtension::exclusiveZone() const { return this->mExclusiveZone; }
|
||||
|
||||
void LayershellWindowExtension::setLayer(Layer::Enum layer) {
|
||||
void LayershellWindowExtension::setLayer(WlrLayer::Enum layer) {
|
||||
if (layer != this->mLayer) {
|
||||
this->mLayer = layer;
|
||||
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) {
|
||||
this->mKeyboardFocus = focus;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "../../core/panelinterface.hpp"
|
||||
|
||||
///! WlrLayershell layer
|
||||
namespace Layer { // NOLINT
|
||||
namespace WlrLayer { // NOLINT
|
||||
Q_NAMESPACE;
|
||||
QML_ELEMENT;
|
||||
|
||||
|
@ -29,7 +29,7 @@ Q_ENUM_NS(Enum);
|
|||
} // namespace Layer
|
||||
|
||||
///! WlrLayershell keyboard focus mode
|
||||
namespace KeyboardFocus { // NOLINT
|
||||
namespace WlrKeyboardFocus { // NOLINT
|
||||
Q_NAMESPACE;
|
||||
QML_ELEMENT;
|
||||
|
||||
|
@ -74,11 +74,11 @@ public:
|
|||
void setExclusiveZone(qint32 exclusiveZone);
|
||||
[[nodiscard]] qint32 exclusiveZone() const;
|
||||
|
||||
void setLayer(Layer::Enum layer);
|
||||
[[nodiscard]] Layer::Enum layer() const;
|
||||
void setLayer(WlrLayer::Enum layer);
|
||||
[[nodiscard]] WlrLayer::Enum layer() const;
|
||||
|
||||
void setKeyboardFocus(KeyboardFocus::Enum focus);
|
||||
[[nodiscard]] KeyboardFocus::Enum keyboardFocus() const;
|
||||
void setKeyboardFocus(WlrKeyboardFocus::Enum focus);
|
||||
[[nodiscard]] WlrKeyboardFocus::Enum keyboardFocus() const;
|
||||
|
||||
// no effect if configured
|
||||
void setUseWindowScreen(bool value);
|
||||
|
@ -101,9 +101,9 @@ private:
|
|||
Anchors mAnchors;
|
||||
Margins mMargins;
|
||||
qint32 mExclusiveZone = 0;
|
||||
Layer::Enum mLayer = Layer::Top;
|
||||
WlrLayer::Enum mLayer = WlrLayer::Top;
|
||||
QString mNamespace = "quickshell";
|
||||
KeyboardFocus::Enum mKeyboardFocus = KeyboardFocus::None;
|
||||
WlrKeyboardFocus::Enum mKeyboardFocus = WlrKeyboardFocus::None;
|
||||
|
||||
friend class QSWaylandLayerSurface;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue