mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-29 20:34:46 +01:00
Clean up stuff
This commit is contained in:
parent
4b043ffecb
commit
63a294f6b1
2 changed files with 2 additions and 74 deletions
|
@ -156,17 +156,7 @@ impl<B: Backend> XwmHandler for CalloopData<B> {
|
|||
|
||||
self.state.windows.push(window.clone());
|
||||
if let Some(focused_output) = self.state.focus_state.focused_output.clone() {
|
||||
focused_output.with_state(|state| {
|
||||
let first_tag = state.focused_tags().next();
|
||||
if let Some(first_tag) = first_tag {
|
||||
first_tag.layout().layout(
|
||||
self.state.windows.clone(),
|
||||
state.focused_tags().cloned().collect(),
|
||||
&mut self.state.space,
|
||||
&focused_output,
|
||||
);
|
||||
}
|
||||
});
|
||||
self.state.update_windows(&focused_output);
|
||||
BLOCKER_COUNTER.store(1, std::sync::atomic::Ordering::SeqCst);
|
||||
tracing::debug!(
|
||||
"blocker {}",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use itertools::{Either, Itertools};
|
||||
use smithay::{
|
||||
desktop::{layer_map_for_output, Space},
|
||||
desktop::layer_map_for_output,
|
||||
output::Output,
|
||||
utils::{Logical, Point, Rectangle, Size},
|
||||
};
|
||||
|
@ -10,7 +10,6 @@ use smithay::{
|
|||
use crate::{
|
||||
backend::Backend,
|
||||
state::{State, WithState},
|
||||
tag::Tag,
|
||||
window::{
|
||||
window_state::{FullscreenOrMaximized, LocationRequestState},
|
||||
WindowElement,
|
||||
|
@ -146,49 +145,6 @@ pub enum Layout {
|
|||
CornerBottomRight,
|
||||
}
|
||||
|
||||
impl Layout {
|
||||
pub fn layout(
|
||||
&self,
|
||||
windows: Vec<WindowElement>,
|
||||
tags: Vec<Tag>,
|
||||
space: &mut Space<WindowElement>,
|
||||
output: &Output,
|
||||
) {
|
||||
let windows = filter_windows(&windows, tags);
|
||||
|
||||
let Some(rect) = space.output_geometry(output).map(|op_geo| {
|
||||
let map = layer_map_for_output(output);
|
||||
if map.layers().peekable().peek().is_none() {
|
||||
// INFO: Sometimes the exclusive zone is some weird number that doesn't match the
|
||||
// | output res, even when there are no layer surfaces mapped. In this case, we
|
||||
// | just return the output geometry.
|
||||
op_geo
|
||||
} else {
|
||||
let zone = map.non_exclusive_zone();
|
||||
tracing::debug!("non_exclusive_zone is {zone:?}");
|
||||
Rectangle::from_loc_and_size(op_geo.loc + zone.loc, zone.size)
|
||||
}
|
||||
}) else {
|
||||
// TODO: maybe default to something like 800x800 like in anvil so people still see
|
||||
// | windows open
|
||||
tracing::error!("Failed to get output geometry");
|
||||
return;
|
||||
};
|
||||
|
||||
tracing::debug!("Laying out with rect {rect:?}");
|
||||
|
||||
match self {
|
||||
Layout::MasterStack => master_stack(windows, rect),
|
||||
Layout::Dwindle => dwindle(windows, rect),
|
||||
Layout::Spiral => spiral(windows, rect),
|
||||
layout @ (Layout::CornerTopLeft
|
||||
| Layout::CornerTopRight
|
||||
| Layout::CornerBottomLeft
|
||||
| Layout::CornerBottomRight) => corner(layout, windows, rect),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn master_stack(windows: Vec<WindowElement>, rect: Rectangle<i32, Logical>) {
|
||||
let size = rect.size;
|
||||
let loc = rect.loc;
|
||||
|
@ -475,24 +431,6 @@ fn corner(layout: &Layout, windows: Vec<WindowElement>, rect: Rectangle<i32, Log
|
|||
}
|
||||
}
|
||||
|
||||
fn filter_windows(windows: &[WindowElement], tags: Vec<Tag>) -> Vec<WindowElement> {
|
||||
windows
|
||||
.iter()
|
||||
.filter(|window| window.with_state(|state| state.floating_or_tiled.is_tiled()))
|
||||
.filter(|window| {
|
||||
window.with_state(|state| {
|
||||
for tag in state.tags.iter() {
|
||||
if tags.iter().any(|tg| tg == tag) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
})
|
||||
})
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
impl<B: Backend> State<B> {
|
||||
pub fn swap_window_positions(&mut self, win1: &WindowElement, win2: &WindowElement) {
|
||||
let mut elems = self
|
||||
|
|
Loading…
Add table
Reference in a new issue