Model lock ownership explicitly and allow protected crash recovery
This commit is contained in:
1 parent
570984a39b
commit
8ad5293178
22 files changed
+264
-80
No files matched your search
@@ -20,7 +20,7 @@ impl XdgActivationHandler for Ferese {
|
||||
}
|
||||
|
||||
fn request_activation(&mut self, token: XdgActivationToken, data: XdgActivationTokenData, surface: WlSurface) {
|
||||
if self.session_lock.active || self.input_capture.captures(1) {
|
||||
if self.session_lock.active() || self.input_capture.captures(1) {
|
||||
return;
|
||||
}
|
||||
let valid = data.serial.is_some() && data.timestamp.elapsed() <= TOKEN_MAX_AGE;
|
||||
|
||||
@@ -79,7 +79,7 @@ impl CompositorHandler for Ferese {
|
||||
}
|
||||
|
||||
fn destroyed(&mut self, surface: &WlSurface) {
|
||||
if self.session_lock.active {
|
||||
if self.session_lock.active() {
|
||||
self.session_lock
|
||||
.surfaces
|
||||
.retain(|_, lock| lock.wl_surface() != surface);
|
||||
|
||||
@@ -141,7 +141,7 @@ pub fn handle_commit(state: &mut Ferese, surface: &WlSurface) {
|
||||
layer.layer_surface().send_pending_configure();
|
||||
|
||||
let policy = layer.cached_state();
|
||||
if !state.session_lock.active
|
||||
if !state.session_lock.active()
|
||||
&& !state.input_capture.captures(1)
|
||||
&& policy.keyboard_interactivity == KeyboardInteractivity::Exclusive
|
||||
&& matches!(policy.layer, Layer::Top | Layer::Overlay)
|
||||
|
||||
@@ -254,7 +254,7 @@ impl Ferese {
|
||||
return;
|
||||
}
|
||||
let mut used = data.used.lock().unwrap();
|
||||
if self.session_lock.active {
|
||||
if self.session_lock.active() {
|
||||
frame.failed();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ fn finish_conversion(state: &Ferese, result: Conversion) {
|
||||
if !frame.is_alive() || *data.used.lock().unwrap() {
|
||||
return;
|
||||
}
|
||||
if state.session_lock.active
|
||||
if state.session_lock.active()
|
||||
|| !super::screencopy::capture_allowed()
|
||||
|| !state.windows.ids().values().any(|id| *id == snapshot.id)
|
||||
{
|
||||
@@ -263,7 +263,7 @@ impl Ferese {
|
||||
budget: &Arc<Mutex<Budget>>,
|
||||
busy: &mut bool,
|
||||
) -> Option<Snapshot> {
|
||||
if self.session_lock.active || !super::screencopy::capture_allowed() {
|
||||
if self.session_lock.active() || !super::screencopy::capture_allowed() {
|
||||
return None;
|
||||
}
|
||||
let window = self
|
||||
@@ -363,7 +363,7 @@ pub(super) fn copy_snapshot(state: &Ferese, resource: &ZwlrScreencopyFrameV1, da
|
||||
resource.failed();
|
||||
return;
|
||||
};
|
||||
if state.session_lock.active
|
||||
if state.session_lock.active()
|
||||
|| !super::screencopy::capture_allowed()
|
||||
|| !state.windows.ids().values().any(|id| *id == snapshot.id)
|
||||
{
|
||||
|
||||
@@ -112,7 +112,7 @@ impl XdgShellHandler for Ferese {
|
||||
}
|
||||
|
||||
fn move_request(&mut self, surface: ToplevelSurface, seat: wl_seat::WlSeat, serial: Serial) {
|
||||
if self.session_lock.active {
|
||||
if self.session_lock.active() {
|
||||
return;
|
||||
}
|
||||
let Some(seat) = Seat::from_resource(&seat) else {
|
||||
@@ -165,7 +165,7 @@ impl XdgShellHandler for Ferese {
|
||||
serial: Serial,
|
||||
edges: smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel::ResizeEdge,
|
||||
) {
|
||||
if self.session_lock.active {
|
||||
if self.session_lock.active() {
|
||||
return;
|
||||
}
|
||||
let Some(seat) = Seat::from_resource(&seat) else {
|
||||
@@ -240,7 +240,7 @@ impl XdgShellHandler for Ferese {
|
||||
}
|
||||
|
||||
fn grab(&mut self, surface: PopupSurface, seat: wl_seat::WlSeat, serial: Serial) {
|
||||
if self.session_lock.active || self.input_capture.active() {
|
||||
if self.session_lock.active() || self.input_capture.active() {
|
||||
return;
|
||||
}
|
||||
let Some(seat) = Seat::from_resource(&seat) else {
|
||||
|
||||
Reference in new issue
Block a user