aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-03-13 18:34:47 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-03-13 19:09:32 +0300
commit4f16be9e4d3b13925f5fb5368f4e24cba50227c6 (patch)
tree9186eb1900ef69ad675359593a22ee676e52f8e8 /src/handlers
parent0f30306fe52d5445bc16bd8af3e458f8d76eb45f (diff)
downloadniri-4f16be9e4d3b13925f5fb5368f4e24cba50227c6.tar.gz
niri-4f16be9e4d3b13925f5fb5368f4e24cba50227c6.tar.bz2
niri-4f16be9e4d3b13925f5fb5368f4e24cba50227c6.zip
Wait for lock surfaces before locking
Fixes the red flash when locking.
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/compositor.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/handlers/compositor.rs b/src/handlers/compositor.rs
index 527f88b7..43a405ea 100644
--- a/src/handlers/compositor.rs
+++ b/src/handlers/compositor.rs
@@ -21,7 +21,7 @@ use smithay::{delegate_compositor, delegate_shm};
use super::xdg_shell::add_mapped_toplevel_pre_commit_hook;
use crate::handlers::XDG_ACTIVATION_TOKEN_TIMEOUT;
use crate::layout::{ActivateWindow, AddWindowTarget};
-use crate::niri::{ClientState, State};
+use crate::niri::{ClientState, LockState, State};
use crate::utils::transaction::Transaction;
use crate::utils::{is_mapped, send_scale_transform};
use crate::window::{InitialConfigureState, Mapped, ResolvedWindowRules, Unmapped};
@@ -408,16 +408,23 @@ impl CompositorHandler for State {
}
// This might be a lock surface.
- if self.niri.is_locked() {
- for (output, state) in &self.niri.output_state {
- if let Some(lock_surface) = &state.lock_surface {
- if lock_surface.wl_surface() == &root_surface {
+ for (output, state) in &self.niri.output_state {
+ if let Some(lock_surface) = &state.lock_surface {
+ if lock_surface.wl_surface() == &root_surface {
+ if matches!(self.niri.lock_state, LockState::WaitingForSurfaces { .. }) {
+ self.niri.maybe_continue_to_locking();
+ } else {
self.niri.queue_redraw(&output.clone());
- return;
}
+
+ return;
}
}
}
+
+ // This message can trigger for lock surfaces that had a commit right after we unlocked
+ // the session, but that's ok, we don't need to handle them.
+ trace!("commit on an unrecognized surface: {surface:?}, root: {root_surface:?}");
}
fn destroyed(&mut self, surface: &WlSurface) {