diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-20 15:36:08 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-20 15:36:08 +0400 |
| commit | f4cdde1f4f89729f91336ea2f5ad7a1265e3bf70 (patch) | |
| tree | c87d826e5de1cf575fa81c8680b0224d5ce5b26f /src/handlers | |
| parent | 56e02a398d9853a4a52a5200560ca75179f7c23c (diff) | |
| download | niri-f4cdde1f4f89729f91336ea2f5ad7a1265e3bf70.tar.gz niri-f4cdde1f4f89729f91336ea2f5ad7a1265e3bf70.tar.bz2 niri-f4cdde1f4f89729f91336ea2f5ad7a1265e3bf70.zip | |
Fix no outputs case handling in a few places
Diffstat (limited to 'src/handlers')
| -rw-r--r-- | src/handlers/layer_shell.rs | 16 | ||||
| -rw-r--r-- | src/handlers/mod.rs | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/handlers/layer_shell.rs b/src/handlers/layer_shell.rs index bd3fbbcd..7862a9fe 100644 --- a/src/handlers/layer_shell.rs +++ b/src/handlers/layer_shell.rs @@ -24,11 +24,17 @@ impl WlrLayerShellHandler for State { _layer: Layer, namespace: String, ) { - let output = wl_output - .as_ref() - .and_then(Output::from_resource) - .or_else(|| self.niri.layout.active_output().cloned()) - .unwrap(); + let output = if let Some(wl_output) = &wl_output { + Output::from_resource(wl_output) + } else { + self.niri.layout.active_output().cloned() + }; + let Some(output) = output else { + warn!("no output for new layer surface, closing"); + surface.send_close(); + return; + }; + let mut map = layer_map_for_output(&output); map.map_layer(&LayerSurface::new(surface, namespace)) .unwrap(); diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 2cd39fa2..e40306d0 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -288,7 +288,7 @@ impl SessionLockHandler for State { fn new_surface(&mut self, surface: LockSurface, output: WlOutput) { let Some(output) = Output::from_resource(&output) else { - error!("no Output matching WlOutput"); + warn!("no Output matching WlOutput"); return; }; |
