wayland/lock: check for protocol availability before use

Fixes #66
This commit is contained in:
outfoxxed 2025-06-20 16:37:22 -07:00
parent 362c8e1b69
commit c17ea54371
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 11 additions and 0 deletions

View file

@ -22,6 +22,8 @@ QSWaylandSessionLockManager* manager() {
}
} // namespace
bool SessionLockManager::lockAvailable() { return manager()->isActive(); }
bool SessionLockManager::lock() {
if (this->isLocked() || SessionLockManager::sessionLocked()) return false;
this->mLock = manager()->acquireLock();

View file

@ -15,6 +15,8 @@ class SessionLockManager: public QObject {
public:
explicit SessionLockManager(QObject* parent = nullptr): QObject(parent) {}
[[nodiscard]] static bool lockAvailable();
// Returns true if a lock was acquired.
// If true is returned the caller must watch the global screen list and create/destroy
// windows with an attached LockWindowExtension to match it.