shell: Extract FloatingLayout::snap_to_corner to deduplicate snap restore logic
This commit is contained in:
parent
60ecf70910
commit
3f68eee846
3 changed files with 13 additions and 16 deletions
|
|
@ -1641,7 +1641,16 @@ impl FloatingLayout {
|
|||
elements
|
||||
}
|
||||
|
||||
pub fn snapped_geometry(&self, corners: &TiledCorners) -> Rectangle<i32, Local> {
|
||||
pub fn snap_to_corner(&self, mapped: &CosmicMapped, corners: &TiledCorners) {
|
||||
*mapped.floating_tiled.lock().unwrap() = Some(*corners);
|
||||
mapped.set_tiled(true);
|
||||
let snapped_geo = self.snapped_geometry(corners);
|
||||
let output = self.space.outputs().next().unwrap();
|
||||
mapped.set_geometry(snapped_geo.to_global(output));
|
||||
mapped.configure();
|
||||
}
|
||||
|
||||
fn snapped_geometry(&self, corners: &TiledCorners) -> Rectangle<i32, Local> {
|
||||
let output = self.space.outputs().next().unwrap().clone();
|
||||
let layers = layer_map_for_output(&output);
|
||||
let non_exclusive = layers.non_exclusive_zone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue