forked from quickshell/quickshell
		
	
							parent
							
								
									362c8e1b69
								
							
						
					
					
						commit
						c17ea54371
					
				
					 3 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -109,6 +109,13 @@ void WlSessionLock::updateSurfaces(bool show, WlSessionLock* old) {
 | 
			
		|||
 | 
			
		||||
void WlSessionLock::realizeLockTarget(WlSessionLock* old) {
 | 
			
		||||
	if (this->lockTarget) {
 | 
			
		||||
		if (!SessionLockManager::lockAvailable()) {
 | 
			
		||||
			qCritical() << "Cannot start session lock: The current compositor does not support the "
 | 
			
		||||
			               "ext-session-lock-v1 protocol.";
 | 
			
		||||
			this->unlock();
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (this->mSurfaceComponent == nullptr) {
 | 
			
		||||
			qWarning() << "WlSessionLock.surface is null. Aborting lock.";
 | 
			
		||||
			this->unlock();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue