autocommit 2022-04-02 21:13:27 CEST
This commit is contained in:
parent
6de9fb8303
commit
9ec1c5c995
5 changed files with 28 additions and 19 deletions
|
|
@ -281,6 +281,7 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
}
|
}
|
||||||
self.pos
|
self.pos
|
||||||
.set(Rect::new_sized(x1, y1, width, height).unwrap());
|
.set(Rect::new_sized(x1, y1, width, height).unwrap());
|
||||||
|
self.surface.set_absolute_position(x1, y1);
|
||||||
self.client.state.tree_changed();
|
self.client.state.tree_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ impl ZwlrLayerShellV1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
log::info!("output = {:?}", output.position.get());
|
||||||
if req.layer > OVERLAY {
|
if req.layer > OVERLAY {
|
||||||
return Err(GetLayerSurfaceError::UnknownLayer(req.layer));
|
return Err(GetLayerSurfaceError::UnknownLayer(req.layer));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,16 @@ pub struct Renderer<'a> {
|
||||||
|
|
||||||
impl Renderer<'_> {
|
impl Renderer<'_> {
|
||||||
pub fn render_output(&mut self, output: &OutputNode, x: i32, y: i32) {
|
pub fn render_output(&mut self, output: &OutputNode, x: i32, y: i32) {
|
||||||
|
let opos = output.position.get();
|
||||||
macro_rules! render_layer {
|
macro_rules! render_layer {
|
||||||
($layer:expr) => {
|
($layer:expr) => {
|
||||||
for ls in $layer.iter() {
|
for ls in $layer.iter() {
|
||||||
let pos = ls.position();
|
let pos = ls.position();
|
||||||
self.render_layer_surface(ls.deref(), pos.x1(), pos.y1());
|
self.render_layer_surface(
|
||||||
|
ls.deref(),
|
||||||
|
x + pos.x1() - opos.x1(),
|
||||||
|
y + pos.y1() - opos.y1(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +326,7 @@ impl Renderer<'_> {
|
||||||
|
|
||||||
pub fn render_layer_surface(&mut self, surface: &ZwlrLayerSurfaceV1, x: i32, y: i32) {
|
pub fn render_layer_surface(&mut self, surface: &ZwlrLayerSurfaceV1, x: i32, y: i32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let body = surface.position();
|
let body = surface.position().at_point(x, y);
|
||||||
with_scissor(&body, || {
|
with_scissor(&body, || {
|
||||||
self.render_surface(&surface.surface, x, y);
|
self.render_surface(&surface.surface, x, y);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use crate::backend::Output;
|
||||||
use crate::ifs::wl_output::WlOutputGlobal;
|
use crate::ifs::wl_output::WlOutputGlobal;
|
||||||
use crate::rect::Rect;
|
use crate::rect::Rect;
|
||||||
use crate::state::State;
|
use crate::state::State;
|
||||||
use crate::tree::{Node, OutputNode, OutputRenderData, WorkspaceNode};
|
use crate::tree::{OutputNode, OutputRenderData, WorkspaceNode};
|
||||||
use crate::utils::asyncevent::AsyncEvent;
|
use crate::utils::asyncevent::AsyncEvent;
|
||||||
use crate::utils::clonecell::CloneCell;
|
use crate::utils::clonecell::CloneCell;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
|
|
@ -22,10 +22,11 @@ impl OutputHandler {
|
||||||
}
|
}
|
||||||
let name = self.state.globals.name();
|
let name = self.state.globals.name();
|
||||||
let global = Rc::new(WlOutputGlobal::new(name, self.output.clone()));
|
let global = Rc::new(WlOutputGlobal::new(name, self.output.clone()));
|
||||||
|
let x1 = self.state.root.outputs.lock().values().map(|o| o.position.get().x2()).max().unwrap_or(0);
|
||||||
let on = Rc::new(OutputNode {
|
let on = Rc::new(OutputNode {
|
||||||
id: self.state.node_ids.next(),
|
id: self.state.node_ids.next(),
|
||||||
workspaces: Default::default(),
|
workspaces: Default::default(),
|
||||||
position: Cell::new(Default::default()),
|
position: Cell::new(Rect::new_empty(x1, 0)),
|
||||||
workspace: CloneCell::new(None),
|
workspace: CloneCell::new(None),
|
||||||
seat_state: Default::default(),
|
seat_state: Default::default(),
|
||||||
global: global.clone(),
|
global: global.clone(),
|
||||||
|
|
@ -51,7 +52,7 @@ impl OutputHandler {
|
||||||
let workspace = Rc::new(WorkspaceNode {
|
let workspace = Rc::new(WorkspaceNode {
|
||||||
id: self.state.node_ids.next(),
|
id: self.state.node_ids.next(),
|
||||||
output: CloneCell::new(on.clone()),
|
output: CloneCell::new(on.clone()),
|
||||||
position: Cell::new(Default::default()),
|
position: Default::default(),
|
||||||
container: Default::default(),
|
container: Default::default(),
|
||||||
stacked: Default::default(),
|
stacked: Default::default(),
|
||||||
seat_state: Default::default(),
|
seat_state: Default::default(),
|
||||||
|
|
@ -78,8 +79,7 @@ impl OutputHandler {
|
||||||
if new_width != width || new_height != height {
|
if new_width != width || new_height != height {
|
||||||
width = new_width;
|
width = new_width;
|
||||||
height = new_height;
|
height = new_height;
|
||||||
on.clone()
|
on.change_size(new_width, new_height);
|
||||||
.change_extents(&Rect::new_sized(0, 0, new_width, new_height).unwrap());
|
|
||||||
}
|
}
|
||||||
global.update_properties();
|
global.update_properties();
|
||||||
ae.triggered().await;
|
ae.triggered().await;
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,20 @@ impl OutputNode {
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn change_size(&self, width: i32, height: i32) {
|
||||||
|
let pos = self.position.get();
|
||||||
|
let rect = Rect::new_sized(pos.x1(), pos.y1(), width, height).unwrap();
|
||||||
|
self.position.set(rect);
|
||||||
|
if let Some(c) = self.workspace.get() {
|
||||||
|
c.change_extents(&self.workspace_rect());
|
||||||
|
}
|
||||||
|
for layer in &self.layers {
|
||||||
|
for surface in layer.iter() {
|
||||||
|
surface.deref().clone().change_extents(&rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct OutputTitle {
|
pub struct OutputTitle {
|
||||||
|
|
@ -198,16 +212,4 @@ impl Node for OutputNode {
|
||||||
fn into_output(self: Rc<Self>) -> Option<Rc<OutputNode>> {
|
fn into_output(self: Rc<Self>) -> Option<Rc<OutputNode>> {
|
||||||
Some(self)
|
Some(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
|
||||||
self.position.set(*rect);
|
|
||||||
if let Some(c) = self.workspace.get() {
|
|
||||||
c.change_extents(&self.workspace_rect());
|
|
||||||
}
|
|
||||||
for layer in &self.layers {
|
|
||||||
for surface in layer.iter() {
|
|
||||||
surface.deref().clone().change_extents(rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue