diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-05 09:32:47 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-05 09:35:10 +0300 |
| commit | 734e3a6d3cea277e56baf4531695e989b2d1bdda (patch) | |
| tree | 71d6e8e9ceb01e8d9f4acaa6b04514bad1ef3142 /src/handlers/xdg_shell.rs | |
| parent | f18b1a70434755b92a8f0a59e8aa0302309e8b3a (diff) | |
| download | niri-734e3a6d3cea277e56baf4531695e989b2d1bdda.tar.gz niri-734e3a6d3cea277e56baf4531695e989b2d1bdda.tar.bz2 niri-734e3a6d3cea277e56baf4531695e989b2d1bdda.zip | |
Fix find_window_and_output() returning None with no outputs
As far as I can tell, this would mess up a ton of the logic. Not sure
how anything worked with no outputs before?
Diffstat (limited to 'src/handlers/xdg_shell.rs')
| -rw-r--r-- | src/handlers/xdg_shell.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 65d45310..5cac5d29 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -123,6 +123,10 @@ impl XdgShellHandler for State { return; }; + let Some(output) = output else { + return; + }; + let window = mapped.window.clone(); let output = output.clone(); @@ -434,7 +438,7 @@ impl XdgShellHandler for State { let window = mapped.window.clone(); if let Some(requested_output) = requested_output { - if &requested_output != current_output { + if Some(&requested_output) != current_output { self.niri .layout .move_to_output(Some(&window), &requested_output, None); @@ -467,7 +471,7 @@ impl XdgShellHandler for State { toplevel .parent() .and_then(|parent| self.niri.layout.find_window_and_output(&parent)) - .map(|(_win, output)| output) + .and_then(|(_win, output)| output) .and_then(|o| self.niri.layout.monitor_for_output(o)) .map(|mon| (mon, true)) }) @@ -556,7 +560,7 @@ impl XdgShellHandler for State { .and_then(|parent| { self.niri.layout.find_window_and_output(&parent) }) - .map(|(_win, output)| output) + .and_then(|(_win, output)| output) .and_then(|o| self.niri.layout.monitor_for_output(o)) .map(|mon| (mon, true)) }) @@ -642,7 +646,7 @@ impl XdgShellHandler for State { return; }; let window = mapped.window.clone(); - let output = output.clone(); + let output = output.cloned(); #[cfg(feature = "xdp-gnome-screencast")] self.niri @@ -678,7 +682,9 @@ impl XdgShellHandler for State { self.maybe_warp_cursor_to_focus(); } - self.niri.queue_redraw(&output); + if let Some(output) = output { + self.niri.queue_redraw(&output); + } } fn popup_destroyed(&mut self, surface: PopupSurface) { @@ -862,7 +868,7 @@ impl State { toplevel .parent() .and_then(|parent| self.niri.layout.find_window_and_output(&parent)) - .map(|(_win, output)| output) + .and_then(|(_win, output)| output) .and_then(|o| self.niri.layout.monitor_for_output(o)) .map(|mon| (mon, true)) }); |
