add new fht compositor patch
This commit is contained in:
parent
74286bc43d
commit
2f6ff7a141
2 changed files with 129 additions and 0 deletions
|
|
@ -79,6 +79,7 @@ in
|
||||||
patches = (old.patches or [ ]) ++ [
|
patches = (old.patches or [ ]) ++ [
|
||||||
./resize-tiled-windows.patch
|
./resize-tiled-windows.patch
|
||||||
./lone-modifier.patch
|
./lone-modifier.patch
|
||||||
|
./session-lock-fail-closed.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.makeWrapper ];
|
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.makeWrapper ];
|
||||||
|
|
|
||||||
128
modules/desktop/wm/fht-compositor/session-lock-fail-closed.patch
Normal file
128
modules/desktop/wm/fht-compositor/session-lock-fail-closed.patch
Normal file
|
|
@ -0,0 +1,128 @@
|
||||||
|
--- a/src/handlers/session_lock.rs
|
||||||
|
+++ b/src/handlers/session_lock.rs
|
||||||
|
@@ -117,9 +117,11 @@
|
||||||
|
|
||||||
|
impl Fht {
|
||||||
|
pub fn is_locked(&self) -> bool {
|
||||||
|
+ // Fail closed: as soon as a lock is requested, session contents and input must be hidden,
|
||||||
|
+ // even if the lock client is slow (or never) providing surfaces.
|
||||||
|
matches!(
|
||||||
|
&self.lock_state,
|
||||||
|
- LockState::Locked(_) | LockState::Locking(_)
|
||||||
|
+ LockState::Locked(_) | LockState::Locking(_) | LockState::WaitingForSurfaces(_)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -130,8 +132,11 @@
|
||||||
|
|
||||||
|
let has_surfaces = self
|
||||||
|
.output_state
|
||||||
|
- .values()
|
||||||
|
- .all(|state| state.lock_surface.is_some());
|
||||||
|
+ .iter()
|
||||||
|
+ // State of disconnected outputs is never removed, and they will never get a lock
|
||||||
|
+ // surface, so only wait for outputs that still exist.
|
||||||
|
+ .filter(|(output, _)| self.space.outputs().any(|o| o == *output))
|
||||||
|
+ .all(|(_, state)| state.lock_surface.is_some());
|
||||||
|
if !has_surfaces {
|
||||||
|
trace!("not locking session, waiting for other lock surfaces");
|
||||||
|
// still didn't map everything.
|
||||||
|
@@ -161,6 +166,14 @@
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Black while the lock client is still mapping its surfaces, red once locked, where it
|
||||||
|
+ // can only be seen if a lock surface is missing (the lock client died, new output, etc).
|
||||||
|
+ let backdrop_color = if matches!(self.lock_state, LockState::Locked(_)) {
|
||||||
|
+ [1., 0., 0., 1.]
|
||||||
|
+ } else {
|
||||||
|
+ [0., 0., 0., 1.]
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
let output_state = self.output_state.get_mut(output).unwrap();
|
||||||
|
// Inform that we finally rendered this output with its designated lock surface.
|
||||||
|
output_state.rendered_with_lock = true;
|
||||||
|
@@ -176,6 +189,21 @@
|
||||||
|
&mut |e| push(e.into()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Always cover the output, so nothing leaks when there's no lock surface (yet), for
|
||||||
|
+ // example on a newly connected output or if the lock client died.
|
||||||
|
+ output_state
|
||||||
|
+ .lock_backdrop
|
||||||
|
+ .update(output.geometry().size, backdrop_color);
|
||||||
|
+ push(SessionLockRenderElement::ClearBackdrop(
|
||||||
|
+ SolidColorRenderElement::from_buffer(
|
||||||
|
+ &output_state.lock_backdrop,
|
||||||
|
+ Point::default(),
|
||||||
|
+ scale,
|
||||||
|
+ 1.0,
|
||||||
|
+ Kind::Unspecified,
|
||||||
|
+ ),
|
||||||
|
+ ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/src/output.rs
|
||||||
|
+++ b/src/output.rs
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
use smithay::backend::renderer::damage::OutputDamageTracker;
|
||||||
|
+use smithay::backend::renderer::element::solid::SolidColorBuffer;
|
||||||
|
use smithay::output::Output;
|
||||||
|
use smithay::reexports::calloop::RegistrationToken;
|
||||||
|
use smithay::wayland::session_lock::LockSurface;
|
||||||
|
@@ -57,6 +58,8 @@
|
||||||
|
pub lock_surface: Option<LockSurface>,
|
||||||
|
/// Whether the output rendered a frame with the [`lock_surface`] yet.
|
||||||
|
pub rendered_with_lock: bool,
|
||||||
|
+ /// Backdrop drawn below the [`lock_surface`], covering the output while locked.
|
||||||
|
+ pub lock_backdrop: SolidColorBuffer,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A state machine to describe where an [`Output`](smithay::output::Output) in the redraw loop.
|
||||||
|
--- a/src/renderer/mod.rs
|
||||||
|
+++ b/src/renderer/mod.rs
|
||||||
|
@@ -205,6 +205,8 @@
|
||||||
|
self.render_session_lock(renderer, output, &mut |e| {
|
||||||
|
push(FhtRenderElement::SessionLock(e))
|
||||||
|
});
|
||||||
|
+ // The lock covers everything, don't even render session contents below it.
|
||||||
|
+ return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
let layer_map = layer_map_for_output(output);
|
||||||
|
--- a/src/state.rs
|
||||||
|
+++ b/src/state.rs
|
||||||
|
@@ -268,8 +268,10 @@
|
||||||
|
let all_locked = self
|
||||||
|
.fht
|
||||||
|
.output_state
|
||||||
|
- .values()
|
||||||
|
- .all(|state| state.rendered_with_lock);
|
||||||
|
+ .iter()
|
||||||
|
+ // Disconnected outputs will never render again, ignore them.
|
||||||
|
+ .filter(|(output, _)| self.fht.space.outputs().any(|o| o == *output))
|
||||||
|
+ .all(|(_, state)| state.rendered_with_lock);
|
||||||
|
|
||||||
|
if all_locked {
|
||||||
|
// All outputs are locked, report success.
|
||||||
|
@@ -1072,6 +1074,7 @@
|
||||||
|
lock_surface: None,
|
||||||
|
// If we are already locked, the first frame should have the lock surface.
|
||||||
|
rendered_with_lock: self.is_locked(),
|
||||||
|
+ lock_backdrop: smithay::backend::renderer::element::solid::SolidColorBuffer::new(output.geometry().size, [0., 0., 0., 1.]),
|
||||||
|
};
|
||||||
|
self.output_state.insert(output.clone(), state);
|
||||||
|
|
||||||
|
@@ -1107,6 +1110,10 @@
|
||||||
|
for layer in layer_map_for_output(output).layers() {
|
||||||
|
layer.layer_surface().send_close()
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // A pending session lock might have only been waiting on this output.
|
||||||
|
+ self.try_continue_locking();
|
||||||
|
+ self.queue_redraw_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn focus_output(&mut self, output: &Output) {
|
||||||
Loading…
Reference in a new issue