1
0
Fork 0
forked from wry/wry

autocommit 2022-01-30 22:41:40 CET

This commit is contained in:
Julian Orth 2022-01-30 22:41:40 +01:00
parent f577f5feef
commit 865d5f295d
26 changed files with 1085 additions and 676 deletions

View file

@ -1,12 +1,12 @@
use crate::backend::Output;
use crate::ifs::wl_output::WlOutputGlobal;
use crate::rect::Rect;
use crate::tree::{Node, OutputNode, WorkspaceNode};
use crate::utils::asyncevent::AsyncEvent;
use crate::utils::clonecell::CloneCell;
use crate::State;
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use crate::rect::Rect;
pub struct OutputHandler {
pub state: Rc<State>,
@ -27,12 +27,14 @@ impl OutputHandler {
workspaces: RefCell::new(vec![]),
position: Cell::new(Default::default()),
workspace: CloneCell::new(None),
seat_state: Default::default(),
});
let workspace = Rc::new(WorkspaceNode {
id: self.state.node_ids.next(),
output: CloneCell::new(on.clone()),
container: Default::default(),
stacked: Default::default(),
seat_state: Default::default(),
});
on.workspace.set(Some(workspace));
self.state.root.outputs.set(self.output.id(), on.clone());
@ -51,7 +53,8 @@ impl OutputHandler {
if new_width != width || new_height != height {
width = new_width;
height = new_height;
on.clone().change_extents(&Rect::new_sized(0, 0, new_width, new_height).unwrap());
on.clone()
.change_extents(&Rect::new_sized(0, 0, new_width, new_height).unwrap());
}
global.update_properties();
ae.triggered().await;

View file

@ -22,7 +22,7 @@ impl SeatHandler {
let _tree_changed = self
.state
.eng
.spawn(tree_changed(global.clone(), self.tree_changed.clone()));
.spawn(tree_changed(self.state.clone(), global.clone(), self.tree_changed.clone()));
let mut _node = self.state.seat_queue.add_last(global.clone());
self.state.add_global(&global);
loop {
@ -44,9 +44,10 @@ impl SeatHandler {
}
}
async fn tree_changed(global: Rc<WlSeatGlobal>, tree_changed: Rc<AsyncEvent>) {
async fn tree_changed(state: Rc<State>, global: Rc<WlSeatGlobal>, tree_changed: Rc<AsyncEvent>) {
loop {
tree_changed.triggered().await;
state.tree_changed_sent.set(false);
global.tree_changed();
}
}