forge
Explore
Log in

Don't you dare go Hollow

layout: Replace move_window_to_output with move_to_output

Browse files at this commit

58fc5f3b06242fc6d6d3e3339222ebba6a4aac59Ivan MolodetskikhParent: 7d4e99b
src/handlers/mod.rsmodified+1 -1
@@ -474,7 +474,7 @@ impl ForeignToplevelHandler for State {
474 if &requested_output != current_output {474 if &requested_output != current_output {
475 self.niri475 self.niri
476 .layout476 .layout
477- .move_window_to_output(&window, &requested_output);477+ .move_to_output(Some(&window), &requested_output, None);
478 }478 }
479 }479 }
480 480
src/handlers/xdg_shell.rsmodified+1 -1
@@ -288,7 +288,7 @@ impl XdgShellHandler for State {
288 if &requested_output != current_output {288 if &requested_output != current_output {
289 self.niri289 self.niri
290 .layout290 .layout
291- .move_window_to_output(&window, &requested_output);291+ .move_to_output(Some(&window), &requested_output, None);
292 }292 }
293 }293 }
294 294
src/layout/mod.rsmodified+0 -34
@@ -2173,40 +2173,6 @@ impl<W: LayoutElement> Layout<W> {
2173 }2173 }
2174 }2174 }
2175 2175
2176- pub fn move_window_to_output(&mut self, window: &W::Id, output: &Output) {
2177- let mut width = None;
2178- let mut is_full_width = false;
2179-
2180- if let MonitorSet::Normal { monitors, .. } = &mut self.monitor_set {
2181- for mon in &*monitors {
2182- for ws in &mon.workspaces {
2183- for col in &ws.columns {
2184- if col.contains(window) {
2185- width = Some(col.width);
2186- is_full_width = col.is_full_width;
2187- break;
2188- }
2189- }
2190- }
2191- }
2192- }
2193-
2194- let Some(width) = width else { return };
2195-
2196- let window = self.remove_window(window, Transaction::new()).unwrap();
2197-
2198- if let MonitorSet::Normal { monitors, .. } = &mut self.monitor_set {
2199- let new_idx = monitors
2200- .iter()
2201- .position(|mon| &mon.output == output)
2202- .unwrap();
2203-
2204- let workspace_idx = monitors[new_idx].active_workspace_idx;
2205- // FIXME: activate only if it was already active and focused.
2206- self.add_window_by_idx(new_idx, workspace_idx, window, true, width, is_full_width);
2207- }
2208- }
2209-
2210 pub fn move_workspace_to_output(&mut self, output: &Output) {2176 pub fn move_workspace_to_output(&mut self, output: &Output) {
2211 let MonitorSet::Normal {2177 let MonitorSet::Normal {
2212 monitors,2178 monitors,