layout: Remove duplicated function

This commit is contained in:
Ivan Molodetskikh
2025-03-29 12:38:43 +03:00
parent d639eb0032
commit 3bb7e60311
3 changed files with 5 additions and 22 deletions
+1 -1
View File
@@ -373,7 +373,7 @@ impl ClientDndGrabHandler for State {
// We can't even get the current pointer location because it's locked (we're deep
// in the grab call stack here). So use the last known one.
if let Some(output) = &self.niri.pointer_contents.output {
self.niri.layout.activate_output(output);
self.niri.layout.focus_output(output);
}
}
}
+4 -4
View File
@@ -2237,7 +2237,7 @@ impl State {
let mod_down = modifiers_from_state(mods).contains(mod_key.to_modifiers());
if mod_down {
if let Some(output) = self.niri.output_under_cursor() {
self.niri.layout.activate_output(&output);
self.niri.layout.focus_output(&output);
let location = pointer.current_location();
let start_data = PointerGrabStartData {
@@ -2368,7 +2368,7 @@ impl State {
// FIXME: granular.
self.niri.queue_redraw_all();
} else if let Some(output) = self.niri.output_under_cursor() {
self.niri.layout.activate_output(&output);
self.niri.layout.focus_output(&output);
// FIXME: granular.
self.niri.queue_redraw_all();
@@ -2687,7 +2687,7 @@ impl State {
// FIXME: granular.
self.niri.queue_redraw_all();
} else if let Some(output) = under.output {
self.niri.layout.activate_output(&output);
self.niri.layout.focus_output(&output);
// FIXME: granular.
self.niri.queue_redraw_all();
@@ -3084,7 +3084,7 @@ impl State {
// FIXME: granular.
self.niri.queue_redraw_all();
} else if let Some(output) = under.output {
self.niri.layout.activate_output(&output);
self.niri.layout.focus_output(&output);
// FIXME: granular.
self.niri.queue_redraw_all();
-17
View File
@@ -1576,23 +1576,6 @@ impl<W: LayoutElement> Layout<W> {
}
}
pub fn activate_output(&mut self, output: &Output) {
let MonitorSet::Normal {
monitors,
active_monitor_idx,
..
} = &mut self.monitor_set
else {
return;
};
let idx = monitors
.iter()
.position(|mon| &mon.output == output)
.unwrap();
*active_monitor_idx = idx;
}
pub fn active_output(&self) -> Option<&Output> {
let MonitorSet::Normal {
monitors,