mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
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?
This commit is contained in:
+29
-20
@@ -1142,26 +1142,6 @@ impl<W: LayoutElement> Layout<W> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_window_and_output(&self, wl_surface: &WlSurface) -> Option<(&W, &Output)> {
|
||||
if let Some(InteractiveMoveState::Moving(move_)) = &self.interactive_move {
|
||||
if move_.tile.window().is_wl_surface(wl_surface) {
|
||||
return Some((move_.tile.window(), &move_.output));
|
||||
}
|
||||
}
|
||||
|
||||
if let MonitorSet::Normal { monitors, .. } = &self.monitor_set {
|
||||
for mon in monitors {
|
||||
for ws in &mon.workspaces {
|
||||
if let Some(window) = ws.find_wl_surface(wl_surface) {
|
||||
return Some((window, &mon.output));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn find_workspace_by_id(&self, id: WorkspaceId) -> Option<(usize, &Workspace<W>)> {
|
||||
match &self.monitor_set {
|
||||
MonitorSet::Normal { ref monitors, .. } => {
|
||||
@@ -1278,6 +1258,35 @@ impl<W: LayoutElement> Layout<W> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_window_and_output(&self, wl_surface: &WlSurface) -> Option<(&W, Option<&Output>)> {
|
||||
if let Some(InteractiveMoveState::Moving(move_)) = &self.interactive_move {
|
||||
if move_.tile.window().is_wl_surface(wl_surface) {
|
||||
return Some((move_.tile.window(), Some(&move_.output)));
|
||||
}
|
||||
}
|
||||
|
||||
match &self.monitor_set {
|
||||
MonitorSet::Normal { monitors, .. } => {
|
||||
for mon in monitors {
|
||||
for ws in &mon.workspaces {
|
||||
if let Some(window) = ws.find_wl_surface(wl_surface) {
|
||||
return Some((window, Some(&mon.output)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MonitorSet::NoOutputs { workspaces } => {
|
||||
for ws in workspaces {
|
||||
if let Some(window) = ws.find_wl_surface(wl_surface) {
|
||||
return Some((window, None));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn find_window_and_output_mut(
|
||||
&mut self,
|
||||
wl_surface: &WlSurface,
|
||||
|
||||
Reference in New Issue
Block a user