mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Fix no outputs case handling in a few places
This commit is contained in:
@@ -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();
|
||||
|
||||
+1
-1
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -94,7 +94,13 @@ where
|
||||
overlay_cursor,
|
||||
output,
|
||||
} => {
|
||||
let output = Output::from_resource(&output).unwrap();
|
||||
let Some(output) = Output::from_resource(&output) else {
|
||||
trace!("screencopy client requested non-existent output");
|
||||
let frame = data_init.init(frame, ScreencopyFrameState::Failed);
|
||||
frame.failed();
|
||||
return;
|
||||
};
|
||||
|
||||
let buffer_size = output.current_mode().unwrap().size;
|
||||
let region_loc = Point::from((0, 0));
|
||||
|
||||
@@ -116,7 +122,13 @@ where
|
||||
return;
|
||||
}
|
||||
|
||||
let output = Output::from_resource(&output).unwrap();
|
||||
let Some(output) = Output::from_resource(&output) else {
|
||||
trace!("screencopy client requested non-existent output");
|
||||
let frame = data_init.init(frame, ScreencopyFrameState::Failed);
|
||||
frame.failed();
|
||||
return;
|
||||
};
|
||||
|
||||
let output_transform = output.current_transform();
|
||||
let output_physical_size =
|
||||
output_transform.transform_size(output.current_mode().unwrap().size);
|
||||
|
||||
Reference in New Issue
Block a user