shell/tiling: Fix wrong order for window positions

This commit is contained in:
Victoria Brekenfeld 2022-10-21 21:05:34 +02:00
parent 00f1b029da
commit e3ef569a6b

View file

@ -28,7 +28,7 @@ use smithay::{
use std::{ use std::{
borrow::Borrow, borrow::Borrow,
cell::RefCell, cell::RefCell,
collections::HashMap, collections::{HashMap, VecDeque},
hash::Hash, hash::Hash,
sync::{atomic::AtomicBool, Arc}, sync::{atomic::AtomicBool, Arc},
}; };
@ -756,7 +756,7 @@ impl TilingLayout {
.map(|(output_data, tree)| (&output_data.output, tree)) .map(|(output_data, tree)| (&output_data.output, tree))
{ {
if let Some(root) = tree.root_node_id() { if let Some(root) = tree.root_node_id() {
let mut stack = Vec::new(); let mut stack = VecDeque::new();
let mut geo = Some(layer_map_for_output(&output).non_exclusive_zone()); let mut geo = Some(layer_map_for_output(&output).non_exclusive_zone());
// TODO saturate? minimum? // TODO saturate? minimum?
@ -778,7 +778,7 @@ impl TilingLayout {
.into_iter() .into_iter()
{ {
let node = tree.get_mut(&node_id).unwrap(); let node = tree.get_mut(&node_id).unwrap();
let geo = stack.pop().unwrap_or(geo); let geo = stack.pop_front().unwrap_or(geo);
if let Some(geo) = geo { if let Some(geo) = geo {
let data = node.data_mut(); let data = node.data_mut();
data.update_geometry(geo); data.update_geometry(geo);
@ -789,7 +789,7 @@ impl TilingLayout {
Orientation::Horizontal => { Orientation::Horizontal => {
let mut previous = 0; let mut previous = 0;
for size in sizes { for size in sizes {
stack.push(Some(Rectangle::from_loc_and_size( stack.push_back(Some(Rectangle::from_loc_and_size(
(geo.loc.x, geo.loc.y + previous), (geo.loc.x, geo.loc.y + previous),
(geo.size.w, *size), (geo.size.w, *size),
))); )));
@ -799,7 +799,7 @@ impl TilingLayout {
Orientation::Vertical => { Orientation::Vertical => {
let mut previous = 0; let mut previous = 0;
for size in sizes { for size in sizes {
stack.push(Some(Rectangle::from_loc_and_size( stack.push_back(Some(Rectangle::from_loc_and_size(
(geo.loc.x + previous, geo.loc.y), (geo.loc.x + previous, geo.loc.y),
(*size, geo.size.h), (*size, geo.size.h),
))); )));
@ -818,8 +818,8 @@ impl TilingLayout {
} }
} }
} else if node.data().is_group() { } else if node.data().is_group() {
stack.push(None); stack.push_back(None);
stack.push(None); stack.push_back(None);
} }
} }
} }