aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-06-10 17:02:51 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-06-10 17:03:32 +0300
commit0407ac5e4ce67255388d7ed8d85ffdbe14ec99ab (patch)
tree07c5bb29d9f38841905608a2a6fe510ffd3cf2ba
parenta18d24fc24d8b17242e336ccf39fcbe91e8161fd (diff)
downloadniri-0407ac5e4ce67255388d7ed8d85ffdbe14ec99ab.tar.gz
niri-0407ac5e4ce67255388d7ed8d85ffdbe14ec99ab.tar.bz2
niri-0407ac5e4ce67255388d7ed8d85ffdbe14ec99ab.zip
Ignore lock surfaces from unrelated clients
gtklock doesn't mind the fact that it got denied the lock, and just creates a new lock surface anyway. And we happily replace the running lock with it.
-rw-r--r--src/niri.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/niri.rs b/src/niri.rs
index bf1cbd54..3c346553 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -5707,8 +5707,18 @@ impl Niri {
}
pub fn new_lock_surface(&mut self, surface: LockSurface, output: &Output) {
- if matches!(self.lock_state, LockState::Unlocked) {
- error!("tried to add a lock surface on an unlocked session");
+ let lock = match &self.lock_state {
+ LockState::Unlocked => {
+ error!("tried to add a lock surface on an unlocked session");
+ return;
+ }
+ LockState::WaitingForSurfaces { confirmation, .. } => confirmation.ext_session_lock(),
+ LockState::Locking(confirmation) => confirmation.ext_session_lock(),
+ LockState::Locked(lock) => lock,
+ };
+
+ if lock.client() != surface.wl_surface().client() {
+ debug!("ignoring lock surface from an unrelated client");
return;
}