surface: move pending state into the surface
This commit is contained in:
parent
943626a7f7
commit
0c48247740
4 changed files with 108 additions and 74 deletions
|
|
@ -25,11 +25,14 @@ use {
|
||||||
NodeSeatState, SeatId, WlSeatGlobal,
|
NodeSeatState, SeatId, WlSeatGlobal,
|
||||||
},
|
},
|
||||||
wl_surface::{
|
wl_surface::{
|
||||||
cursor::CursorSurface, wl_subsurface::WlSubsurface,
|
cursor::CursorSurface,
|
||||||
|
wl_subsurface::{PendingSubsurfaceData, WlSubsurface},
|
||||||
wp_fractional_scale_v1::WpFractionalScaleV1,
|
wp_fractional_scale_v1::WpFractionalScaleV1,
|
||||||
wp_tearing_control_v1::WpTearingControlV1, wp_viewport::WpViewport,
|
wp_tearing_control_v1::WpTearingControlV1,
|
||||||
x_surface::XSurface, xdg_surface::XdgSurfaceError,
|
wp_viewport::WpViewport,
|
||||||
zwlr_layer_surface_v1::ZwlrLayerSurfaceV1Error,
|
x_surface::XSurface,
|
||||||
|
xdg_surface::{PendingXdgSurfaceData, XdgSurfaceError},
|
||||||
|
zwlr_layer_surface_v1::{PendingLayerSurfaceData, ZwlrLayerSurfaceV1Error},
|
||||||
},
|
},
|
||||||
wp_content_type_v1::ContentType,
|
wp_content_type_v1::ContentType,
|
||||||
wp_presentation_feedback::WpPresentationFeedback,
|
wp_presentation_feedback::WpPresentationFeedback,
|
||||||
|
|
@ -281,6 +284,9 @@ struct PendingState {
|
||||||
xwayland_serial: Option<u64>,
|
xwayland_serial: Option<u64>,
|
||||||
tearing: Option<bool>,
|
tearing: Option<bool>,
|
||||||
content_type: Option<Option<ContentType>>,
|
content_type: Option<Option<ContentType>>,
|
||||||
|
subsurface: Option<Box<PendingSubsurfaceData>>,
|
||||||
|
xdg_surface: Option<Box<PendingXdgSurfaceData>>,
|
||||||
|
layer_surface: Option<Box<PendingLayerSurfaceData>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,12 @@ use {
|
||||||
buffd::{MsgParser, MsgParserError},
|
buffd::{MsgParser, MsgParserError},
|
||||||
linkedlist::LinkedNode,
|
linkedlist::LinkedNode,
|
||||||
numcell::NumCell,
|
numcell::NumCell,
|
||||||
|
option_ext::OptionExt,
|
||||||
},
|
},
|
||||||
wire::{wl_subsurface::*, WlSubsurfaceId},
|
wire::{wl_subsurface::*, WlSubsurfaceId},
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell, RefMut},
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
},
|
},
|
||||||
|
|
@ -37,14 +38,13 @@ pub struct WlSubsurface {
|
||||||
sync_ancestor: Cell<bool>,
|
sync_ancestor: Cell<bool>,
|
||||||
node: RefCell<Option<LinkedNode<StackElement>>>,
|
node: RefCell<Option<LinkedNode<StackElement>>>,
|
||||||
depth: NumCell<u32>,
|
depth: NumCell<u32>,
|
||||||
pending: PendingSubsurfaceData,
|
|
||||||
pub tracker: Tracker<Self>,
|
pub tracker: Tracker<Self>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct PendingSubsurfaceData {
|
pub struct PendingSubsurfaceData {
|
||||||
node: RefCell<Option<LinkedNode<StackElement>>>,
|
node: Option<LinkedNode<StackElement>>,
|
||||||
position: Cell<Option<(i32, i32)>>,
|
position: Option<(i32, i32)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_children_sync(surface: &WlSubsurface, sync: bool) {
|
fn update_children_sync(surface: &WlSubsurface, sync: bool) {
|
||||||
|
|
@ -92,11 +92,16 @@ impl WlSubsurface {
|
||||||
sync_ancestor: Cell::new(false),
|
sync_ancestor: Cell::new(false),
|
||||||
node: RefCell::new(None),
|
node: RefCell::new(None),
|
||||||
depth: NumCell::new(0),
|
depth: NumCell::new(0),
|
||||||
pending: Default::default(),
|
|
||||||
tracker: Default::default(),
|
tracker: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn pending(&self) -> RefMut<Box<PendingSubsurfaceData>> {
|
||||||
|
RefMut::map(self.surface.pending.borrow_mut(), |m| {
|
||||||
|
m.subsurface.get_or_insert_default_ext()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn install(self: &Rc<Self>) -> Result<(), WlSubsurfaceError> {
|
pub fn install(self: &Rc<Self>) -> Result<(), WlSubsurfaceError> {
|
||||||
if self.surface.id == self.parent.id {
|
if self.surface.id == self.parent.id {
|
||||||
return Err(WlSubsurfaceError::OwnParent(self.surface.id));
|
return Err(WlSubsurfaceError::OwnParent(self.surface.id));
|
||||||
|
|
@ -128,7 +133,7 @@ impl WlSubsurface {
|
||||||
sub_surface: self.clone(),
|
sub_surface: self.clone(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
*self.pending.node.borrow_mut() = Some(node);
|
self.pending().node = Some(node);
|
||||||
self.surface.set_toplevel(self.parent.toplevel.get());
|
self.surface.set_toplevel(self.parent.toplevel.get());
|
||||||
self.sync_ancestor.set(sync_ancestor);
|
self.sync_ancestor.set(sync_ancestor);
|
||||||
self.depth.set(depth);
|
self.depth.set(depth);
|
||||||
|
|
@ -140,7 +145,7 @@ impl WlSubsurface {
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
|
||||||
let _req: Destroy = self.surface.client.parse(self, parser)?;
|
let _req: Destroy = self.surface.client.parse(self, parser)?;
|
||||||
self.surface.unset_ext();
|
self.surface.unset_ext();
|
||||||
*self.pending.node.borrow_mut() = None;
|
self.surface.pending.borrow_mut().subsurface.take();
|
||||||
*self.node.borrow_mut() = None;
|
*self.node.borrow_mut() = None;
|
||||||
{
|
{
|
||||||
let mut children = self.parent.children.borrow_mut();
|
let mut children = self.parent.children.borrow_mut();
|
||||||
|
|
@ -164,7 +169,7 @@ impl WlSubsurface {
|
||||||
|
|
||||||
fn set_position(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
|
fn set_position(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
|
||||||
let req: SetPosition = self.surface.client.parse(self, parser)?;
|
let req: SetPosition = self.surface.client.parse(self, parser)?;
|
||||||
self.pending.position.set(Some((req.x, req.y)));
|
self.pending().position = Some((req.x, req.y));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,7 +193,7 @@ impl WlSubsurface {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
_ => return Err(WlSubsurfaceError::NotASibling(sibling, self.surface.id)),
|
_ => return Err(WlSubsurfaceError::NotASibling(sibling, self.surface.id)),
|
||||||
};
|
};
|
||||||
let node = match sibling.pending.node.borrow().deref() {
|
let node = match &sibling.pending().node {
|
||||||
Some(n) => n.to_ref(),
|
Some(n) => n.to_ref(),
|
||||||
_ => match sibling.node.borrow().deref() {
|
_ => match sibling.node.borrow().deref() {
|
||||||
Some(n) => n.to_ref(),
|
Some(n) => n.to_ref(),
|
||||||
|
|
@ -200,7 +205,7 @@ impl WlSubsurface {
|
||||||
_ => node.prepend(element),
|
_ => node.prepend(element),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.pending.node.borrow_mut().replace(node);
|
self.pending().node.replace(node);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +261,6 @@ object_base! {
|
||||||
|
|
||||||
impl Object for WlSubsurface {
|
impl Object for WlSubsurface {
|
||||||
fn break_loops(&self) {
|
fn break_loops(&self) {
|
||||||
*self.pending.node.borrow_mut() = None;
|
|
||||||
*self.node.borrow_mut() = None;
|
*self.node.borrow_mut() = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -272,15 +276,17 @@ impl SurfaceExt for WlSubsurface {
|
||||||
CommitAction::ContinueCommit
|
CommitAction::ContinueCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_apply_commit(self: Rc<Self>, _pending: &mut PendingState) {
|
fn after_apply_commit(self: Rc<Self>, pending: &mut PendingState) {
|
||||||
if let Some(v) = self.pending.node.take() {
|
if let Some(pending) = &mut pending.subsurface {
|
||||||
v.pending.set(false);
|
if let Some(v) = pending.node.take() {
|
||||||
self.node.borrow_mut().replace(v);
|
v.pending.set(false);
|
||||||
}
|
self.node.borrow_mut().replace(v);
|
||||||
if let Some((x, y)) = self.pending.position.take() {
|
}
|
||||||
self.position
|
if let Some((x, y)) = pending.position.take() {
|
||||||
.set(self.surface.buffer_abs_pos.get().at_point(x, y));
|
self.position
|
||||||
self.parent.need_extents_update.set(true);
|
.set(self.surface.buffer_abs_pos.get().at_point(x, y));
|
||||||
|
self.parent.need_extents_update.set(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,15 @@ use {
|
||||||
clonecell::CloneCell,
|
clonecell::CloneCell,
|
||||||
copyhashmap::CopyHashMap,
|
copyhashmap::CopyHashMap,
|
||||||
numcell::NumCell,
|
numcell::NumCell,
|
||||||
|
option_ext::OptionExt,
|
||||||
},
|
},
|
||||||
wire::{xdg_surface::*, WlSurfaceId, XdgPopupId, XdgSurfaceId},
|
wire::{xdg_surface::*, WlSurfaceId, XdgPopupId, XdgSurfaceId},
|
||||||
},
|
},
|
||||||
std::{cell::Cell, fmt::Debug, rc::Rc},
|
std::{
|
||||||
|
cell::{Cell, RefMut},
|
||||||
|
fmt::Debug,
|
||||||
|
rc::Rc,
|
||||||
|
},
|
||||||
thiserror::Error,
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -65,14 +70,13 @@ pub struct XdgSurface {
|
||||||
pub absolute_desired_extents: Cell<Rect>,
|
pub absolute_desired_extents: Cell<Rect>,
|
||||||
ext: CloneCell<Option<Rc<dyn XdgSurfaceExt>>>,
|
ext: CloneCell<Option<Rc<dyn XdgSurfaceExt>>>,
|
||||||
popups: CopyHashMap<XdgPopupId, Rc<XdgPopup>>,
|
popups: CopyHashMap<XdgPopupId, Rc<XdgPopup>>,
|
||||||
pending: PendingXdgSurfaceData,
|
|
||||||
pub workspace: CloneCell<Option<Rc<WorkspaceNode>>>,
|
pub workspace: CloneCell<Option<Rc<WorkspaceNode>>>,
|
||||||
pub tracker: Tracker<Self>,
|
pub tracker: Tracker<Self>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
struct PendingXdgSurfaceData {
|
pub struct PendingXdgSurfaceData {
|
||||||
geometry: Cell<Option<Rect>>,
|
geometry: Option<Rect>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait XdgSurfaceExt: Debug {
|
pub trait XdgSurfaceExt: Debug {
|
||||||
|
|
@ -103,7 +107,6 @@ impl XdgSurface {
|
||||||
absolute_desired_extents: Cell::new(Default::default()),
|
absolute_desired_extents: Cell::new(Default::default()),
|
||||||
ext: Default::default(),
|
ext: Default::default(),
|
||||||
popups: Default::default(),
|
popups: Default::default(),
|
||||||
pending: Default::default(),
|
|
||||||
workspace: Default::default(),
|
workspace: Default::default(),
|
||||||
tracker: Default::default(),
|
tracker: Default::default(),
|
||||||
}
|
}
|
||||||
|
|
@ -270,6 +273,12 @@ impl XdgSurface {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn pending(&self) -> RefMut<Box<PendingXdgSurfaceData>> {
|
||||||
|
RefMut::map(self.surface.pending.borrow_mut(), |p| {
|
||||||
|
p.xdg_surface.get_or_insert_default_ext()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn set_window_geometry(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
|
fn set_window_geometry(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
|
||||||
let req: SetWindowGeometry = self.surface.client.parse(self, parser)?;
|
let req: SetWindowGeometry = self.surface.client.parse(self, parser)?;
|
||||||
if req.height == 0 && req.width == 0 {
|
if req.height == 0 && req.width == 0 {
|
||||||
|
|
@ -280,7 +289,7 @@ impl XdgSurface {
|
||||||
return Err(XdgSurfaceError::NonPositiveWidthHeight);
|
return Err(XdgSurfaceError::NonPositiveWidthHeight);
|
||||||
}
|
}
|
||||||
let extents = Rect::new_sized(req.x, req.y, req.width, req.height).unwrap();
|
let extents = Rect::new_sized(req.x, req.y, req.width, req.height).unwrap();
|
||||||
self.pending.geometry.set(Some(extents));
|
self.pending().geometry = Some(extents);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -359,7 +368,7 @@ dedicated_add_obj!(XdgSurface, XdgSurfaceId, xdg_surfaces);
|
||||||
impl SurfaceExt for XdgSurface {
|
impl SurfaceExt for XdgSurface {
|
||||||
fn before_apply_commit(
|
fn before_apply_commit(
|
||||||
self: Rc<Self>,
|
self: Rc<Self>,
|
||||||
_pending: &mut PendingState,
|
pending: &mut PendingState,
|
||||||
) -> Result<(), WlSurfaceError> {
|
) -> Result<(), WlSurfaceError> {
|
||||||
{
|
{
|
||||||
let ase = self.acked_serial.get();
|
let ase = self.acked_serial.get();
|
||||||
|
|
@ -373,9 +382,11 @@ impl SurfaceExt for XdgSurface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(geometry) = self.pending.geometry.take() {
|
if let Some(pending) = &mut pending.xdg_surface {
|
||||||
self.geometry.set(Some(geometry));
|
if let Some(geometry) = pending.geometry.take() {
|
||||||
self.update_extents();
|
self.geometry.set(Some(geometry));
|
||||||
|
self.update_extents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,16 @@ use {
|
||||||
cell_ext::CellExt,
|
cell_ext::CellExt,
|
||||||
linkedlist::LinkedNode,
|
linkedlist::LinkedNode,
|
||||||
numcell::NumCell,
|
numcell::NumCell,
|
||||||
|
option_ext::OptionExt,
|
||||||
},
|
},
|
||||||
wire::{zwlr_layer_surface_v1::*, WlSurfaceId, ZwlrLayerSurfaceV1Id},
|
wire::{zwlr_layer_surface_v1::*, WlSurfaceId, ZwlrLayerSurfaceV1Id},
|
||||||
},
|
},
|
||||||
std::{cell::Cell, ops::Deref, rc::Rc},
|
std::{
|
||||||
|
cell::{Cell, RefMut},
|
||||||
|
mem,
|
||||||
|
ops::Deref,
|
||||||
|
rc::Rc,
|
||||||
|
},
|
||||||
thiserror::Error,
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -48,7 +54,6 @@ pub struct ZwlrLayerSurfaceV1 {
|
||||||
pos: Cell<Rect>,
|
pos: Cell<Rect>,
|
||||||
mapped: Cell<bool>,
|
mapped: Cell<bool>,
|
||||||
layer: Cell<u32>,
|
layer: Cell<u32>,
|
||||||
pending: Pending,
|
|
||||||
requested_serial: NumCell<u32>,
|
requested_serial: NumCell<u32>,
|
||||||
acked_serial: Cell<Option<u32>>,
|
acked_serial: Cell<Option<u32>>,
|
||||||
size: Cell<(i32, i32)>,
|
size: Cell<(i32, i32)>,
|
||||||
|
|
@ -61,14 +66,14 @@ pub struct ZwlrLayerSurfaceV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Pending {
|
pub struct PendingLayerSurfaceData {
|
||||||
size: Cell<Option<(i32, i32)>>,
|
size: Option<(i32, i32)>,
|
||||||
anchor: Cell<Option<u32>>,
|
anchor: Option<u32>,
|
||||||
exclusive_zone: Cell<Option<i32>>,
|
exclusive_zone: Option<i32>,
|
||||||
margin: Cell<Option<(i32, i32, i32, i32)>>,
|
margin: Option<(i32, i32, i32, i32)>,
|
||||||
keyboard_interactivity: Cell<Option<u32>>,
|
keyboard_interactivity: Option<u32>,
|
||||||
layer: Cell<Option<u32>>,
|
layer: Option<u32>,
|
||||||
any: Cell<bool>,
|
any: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZwlrLayerSurfaceV1 {
|
impl ZwlrLayerSurfaceV1 {
|
||||||
|
|
@ -93,7 +98,6 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
pos: Default::default(),
|
pos: Default::default(),
|
||||||
mapped: Cell::new(false),
|
mapped: Cell::new(false),
|
||||||
layer: Cell::new(layer),
|
layer: Cell::new(layer),
|
||||||
pending: Default::default(),
|
|
||||||
requested_serial: Default::default(),
|
requested_serial: Default::default(),
|
||||||
acked_serial: Cell::new(None),
|
acked_serial: Cell::new(None),
|
||||||
size: Cell::new((0, 0)),
|
size: Cell::new((0, 0)),
|
||||||
|
|
@ -129,15 +133,20 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
self.client.event(Closed { self_id: self.id });
|
self.client.event(Closed { self_id: self.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn pending(&self) -> RefMut<Box<PendingLayerSurfaceData>> {
|
||||||
|
RefMut::map(self.surface.pending.borrow_mut(), |m| {
|
||||||
|
m.layer_surface.get_or_insert_default_ext()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn set_size(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
fn set_size(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||||
let req: SetSize = self.client.parse(self, parser)?;
|
let req: SetSize = self.client.parse(self, parser)?;
|
||||||
if req.width > u16::MAX as u32 || req.height > u16::MAX as u32 {
|
if req.width > u16::MAX as u32 || req.height > u16::MAX as u32 {
|
||||||
return Err(ZwlrLayerSurfaceV1Error::ExcessiveSize);
|
return Err(ZwlrLayerSurfaceV1Error::ExcessiveSize);
|
||||||
}
|
}
|
||||||
self.pending
|
let mut pending = self.pending();
|
||||||
.size
|
pending.size = Some((req.width as _, req.height as _));
|
||||||
.set(Some((req.width as _, req.height as _)));
|
pending.any = true;
|
||||||
self.pending.any.set(true);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,24 +155,25 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
if req.anchor & !(LEFT | RIGHT | TOP | BOTTOM) != 0 {
|
if req.anchor & !(LEFT | RIGHT | TOP | BOTTOM) != 0 {
|
||||||
return Err(ZwlrLayerSurfaceV1Error::UnknownAnchor(req.anchor));
|
return Err(ZwlrLayerSurfaceV1Error::UnknownAnchor(req.anchor));
|
||||||
}
|
}
|
||||||
self.pending.anchor.set(Some(req.anchor));
|
let mut pending = self.pending();
|
||||||
self.pending.any.set(true);
|
pending.anchor = Some(req.anchor);
|
||||||
|
pending.any = true;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||||
let req: SetExclusiveZone = self.client.parse(self, parser)?;
|
let req: SetExclusiveZone = self.client.parse(self, parser)?;
|
||||||
self.pending.exclusive_zone.set(Some(req.zone));
|
let mut pending = self.pending();
|
||||||
self.pending.any.set(true);
|
pending.exclusive_zone = Some(req.zone);
|
||||||
|
pending.any = true;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_margin(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
fn set_margin(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||||
let req: SetMargin = self.client.parse(self, parser)?;
|
let req: SetMargin = self.client.parse(self, parser)?;
|
||||||
self.pending
|
let mut pending = self.pending();
|
||||||
.margin
|
pending.margin = Some((req.top, req.right, req.bottom, req.left));
|
||||||
.set(Some((req.top, req.right, req.bottom, req.left)));
|
pending.any = true;
|
||||||
self.pending.any.set(true);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,10 +187,9 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
req.keyboard_interactivity,
|
req.keyboard_interactivity,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
self.pending
|
let mut pending = self.pending();
|
||||||
.keyboard_interactivity
|
pending.keyboard_interactivity = Some(req.keyboard_interactivity);
|
||||||
.set(Some(req.keyboard_interactivity));
|
pending.any = true;
|
||||||
self.pending.any.set(true);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,29 +217,31 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
if req.layer > OVERLAY {
|
if req.layer > OVERLAY {
|
||||||
return Err(ZwlrLayerSurfaceV1Error::UnknownLayer(req.layer));
|
return Err(ZwlrLayerSurfaceV1Error::UnknownLayer(req.layer));
|
||||||
}
|
}
|
||||||
self.pending.layer.set(Some(req.layer));
|
let mut pending = self.pending();
|
||||||
self.pending.any.set(true);
|
pending.layer = Some(req.layer);
|
||||||
|
pending.any = true;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pre_commit(&self) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
fn pre_commit(&self, pending: &mut PendingState) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||||
let mut send_configure = self.pending.any.replace(false);
|
let pending = pending.layer_surface.get_or_insert_default_ext();
|
||||||
if let Some(size) = self.pending.size.take() {
|
let mut send_configure = mem::replace(&mut pending.any, false);
|
||||||
|
if let Some(size) = pending.size.take() {
|
||||||
self.size.set(size);
|
self.size.set(size);
|
||||||
}
|
}
|
||||||
if let Some(anchor) = self.pending.anchor.take() {
|
if let Some(anchor) = pending.anchor.take() {
|
||||||
self.anchor.set(anchor);
|
self.anchor.set(anchor);
|
||||||
}
|
}
|
||||||
if let Some(ez) = self.pending.exclusive_zone.take() {
|
if let Some(ez) = pending.exclusive_zone.take() {
|
||||||
self.exclusive_zone.set(ez);
|
self.exclusive_zone.set(ez);
|
||||||
}
|
}
|
||||||
if let Some(margin) = self.pending.margin.take() {
|
if let Some(margin) = pending.margin.take() {
|
||||||
self.margin.set(margin);
|
self.margin.set(margin);
|
||||||
}
|
}
|
||||||
if let Some(ki) = self.pending.keyboard_interactivity.take() {
|
if let Some(ki) = pending.keyboard_interactivity.take() {
|
||||||
self.keyboard_interactivity.set(ki);
|
self.keyboard_interactivity.set(ki);
|
||||||
}
|
}
|
||||||
if let Some(layer) = self.pending.layer.take() {
|
if let Some(layer) = pending.layer.take() {
|
||||||
self.layer.set(layer);
|
self.layer.set(layer);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -313,9 +324,9 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
||||||
fn before_apply_commit(
|
fn before_apply_commit(
|
||||||
self: Rc<Self>,
|
self: Rc<Self>,
|
||||||
_pending: &mut PendingState,
|
pending: &mut PendingState,
|
||||||
) -> Result<(), WlSurfaceError> {
|
) -> Result<(), WlSurfaceError> {
|
||||||
self.deref().pre_commit()?;
|
self.deref().pre_commit(pending)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue