autocommit 2022-04-04 00:28:58 CEST
This commit is contained in:
parent
9ec1c5c995
commit
1f71290dab
21 changed files with 1217 additions and 132 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::backend::Output;
|
||||
use crate::backend::Connector;
|
||||
use crate::client::{Client, ClientError, ClientId};
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::zxdg_output_v1::ZxdgOutputV1;
|
||||
|
|
@ -17,6 +17,7 @@ use std::cell::{Cell, RefCell};
|
|||
use std::collections::hash_map::Entry;
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
use crate::backend;
|
||||
|
||||
const SP_UNKNOWN: i32 = 0;
|
||||
#[allow(dead_code)]
|
||||
|
|
@ -52,18 +53,20 @@ const MODE_PREFERRED: u32 = 2;
|
|||
|
||||
pub struct WlOutputGlobal {
|
||||
name: GlobalName,
|
||||
output: Rc<dyn Output>,
|
||||
pos: Cell<Rect>,
|
||||
pub connector: Rc<dyn Connector>,
|
||||
pub pos: Cell<Rect>,
|
||||
pub mode: Cell<backend::Mode>,
|
||||
pub node: CloneCell<Option<Rc<OutputNode>>>,
|
||||
pub bindings: RefCell<AHashMap<ClientId, AHashMap<WlOutputId, Rc<WlOutput>>>>,
|
||||
}
|
||||
|
||||
impl WlOutputGlobal {
|
||||
pub fn new(name: GlobalName, output: Rc<dyn Output>) -> Self {
|
||||
pub fn new(name: GlobalName, connector: Rc<dyn Connector>, x1: i32) -> Self {
|
||||
Self {
|
||||
name,
|
||||
output: output.clone(),
|
||||
pos: Cell::new(Rect::new_sized(0, 0, output.width(), output.height()).unwrap()),
|
||||
connector: connector.clone(),
|
||||
pos: Cell::new(Rect::new_empty(x1, 0)),
|
||||
mode: Default::default(),
|
||||
node: Default::default(),
|
||||
bindings: Default::default(),
|
||||
}
|
||||
|
|
@ -73,30 +76,18 @@ impl WlOutputGlobal {
|
|||
self.pos.get()
|
||||
}
|
||||
|
||||
pub fn update_properties(&self) {
|
||||
let width = self.output.width();
|
||||
let height = self.output.height();
|
||||
|
||||
let pos = self.pos.get();
|
||||
let old_width = pos.width();
|
||||
let old_height = pos.height();
|
||||
let changed = old_width != width || old_height != height;
|
||||
|
||||
if changed {
|
||||
self.pos
|
||||
.set(Rect::new_sized(pos.x1(), pos.y1(), width, height).unwrap());
|
||||
let bindings = self.bindings.borrow_mut();
|
||||
for binding in bindings.values() {
|
||||
for binding in binding.values() {
|
||||
binding.send_geometry();
|
||||
binding.send_mode();
|
||||
binding.send_scale();
|
||||
binding.send_done();
|
||||
binding.client.flush();
|
||||
let xdg = binding.xdg_outputs.lock();
|
||||
for xdg in xdg.values() {
|
||||
xdg.send_updates();
|
||||
}
|
||||
pub fn send_mode(&self) {
|
||||
let bindings = self.bindings.borrow_mut();
|
||||
for binding in bindings.values() {
|
||||
for binding in binding.values() {
|
||||
binding.send_geometry();
|
||||
binding.send_mode();
|
||||
binding.send_scale();
|
||||
binding.send_done();
|
||||
binding.client.flush();
|
||||
let xdg = binding.xdg_outputs.lock();
|
||||
for xdg in xdg.values() {
|
||||
xdg.send_updates();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ impl XdgPopup {
|
|||
let mut rel_pos = positioner.get_position(false, false);
|
||||
let mut abs_pos = rel_pos.move_(parent_abs.x1(), parent_abs.y1());
|
||||
if let Some(ws) = parent.workspace.get() {
|
||||
let output_pos = ws.output.get().position.get();
|
||||
let output_pos = ws.output.get().global.pos.get();
|
||||
let mut overflow = output_pos.get_overflow(&abs_pos);
|
||||
if !overflow.is_contained() {
|
||||
let mut flip_x = positioner.ca.contains(CA::FLIP_X) && overflow.x_overflow();
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ impl ZwlrLayerSurfaceV1 {
|
|||
if anchor == 0 {
|
||||
anchor = LEFT | RIGHT | TOP | BOTTOM;
|
||||
}
|
||||
let opos = self.output.position.get();
|
||||
let opos = self.output.global.pos.get();
|
||||
let mut x1 = opos.x1();
|
||||
let mut y1 = opos.y1();
|
||||
if anchor.contains(LEFT) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ impl ZwlrLayerShellV1 {
|
|||
}
|
||||
}
|
||||
};
|
||||
log::info!("output = {:?}", output.position.get());
|
||||
log::info!("output = {:?}", output.global.pos.get());
|
||||
if req.layer > OVERLAY {
|
||||
return Err(GetLayerSurfaceError::UnknownLayer(req.layer));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue