MCPcopy Create free account
hub / github.com/StrataWM/strata / refresh_geometry

Function refresh_geometry

src/tiling.rs:27–70  ·  view source on GitHub ↗
(workspace: &mut Workspace)

Source from the content-addressed store, hash-verified

25};
26
27pub fn refresh_geometry(workspace: &mut Workspace) {
28 let gaps = { (3, 3) };
29 let output = layer_map_for_output(workspace.outputs().next().unwrap()).non_exclusive_zone();
30 let output_full = workspace.outputs().next().unwrap().current_mode().unwrap().size;
31
32 match &mut workspace.layout_tree {
33 Dwindle::Empty => {}
34 Dwindle::Window(w) => {
35 w.borrow_mut().rec = Rectangle {
36 loc: Point::from((gaps.0 + gaps.1 + output.loc.x, gaps.0 + gaps.1 + output.loc.y)),
37 size: Size::from((
38 output.size.w - ((gaps.0 + gaps.1) * 2),
39 output.size.h - ((gaps.0 + gaps.1) * 2),
40 )),
41 };
42 }
43 Dwindle::Split { left, right, split, ratio } => {
44 if let Dwindle::Window(w) = left.as_mut() {
45 generate_layout(
46 right.as_mut(),
47 w,
48 Rectangle {
49 loc: Point::from((gaps.0 + output.loc.x, gaps.0 + output.loc.y)),
50 size: Size::from((
51 output.size.w - (gaps.0 * 2),
52 output.size.h - (gaps.0 * 2),
53 )),
54 },
55 *split,
56 *ratio,
57 Size::from((output_full.w - gaps.0, output_full.h - gaps.0)),
58 gaps,
59 )
60 }
61 }
62 }
63 for strata_window in workspace.strata_windows() {
64 let xdg_toplevel = strata_window.smithay_window.toplevel();
65 xdg_toplevel.with_pending_state(|state| {
66 state.size = Some(strata_window.rec.size);
67 });
68 xdg_toplevel.send_configure();
69 }
70}
71
72pub fn generate_layout(
73 tree: &mut Dwindle,

Callers 5

add_windowMethod · 0.85
remove_windowMethod · 0.85
new_layer_surfaceMethod · 0.85
layer_destroyedMethod · 0.85

Calls 3

generate_layoutFunction · 0.85
outputsMethod · 0.80
strata_windowsMethod · 0.80

Tested by

no test coverage detected