all: add (Clone)Cell::is_some and is_none
This commit is contained in:
parent
7a67784502
commit
54d93f84da
32 changed files with 98 additions and 62 deletions
|
|
@ -29,7 +29,7 @@ impl WpFractionalScaleV1 {
|
|||
}
|
||||
|
||||
pub fn install(self: &Rc<Self>) -> Result<(), WpFractionalScaleError> {
|
||||
if self.surface.fractional_scale.get().is_some() {
|
||||
if self.surface.fractional_scale.is_some() {
|
||||
return Err(WpFractionalScaleError::Exists);
|
||||
}
|
||||
self.surface.fractional_scale.set(Some(self.clone()));
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub struct WpTearingControlV1 {
|
|||
|
||||
impl WpTearingControlV1 {
|
||||
pub fn install(self: &Rc<Self>) -> Result<(), WpTearingControlV1Error> {
|
||||
if self.surface.tearing_control.get().is_some() {
|
||||
if self.surface.tearing_control.is_some() {
|
||||
return Err(WpTearingControlV1Error::AlreadyAttached(self.surface.id));
|
||||
}
|
||||
self.surface.tearing_control.set(Some(self.clone()));
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl WpViewport {
|
|||
}
|
||||
|
||||
pub fn install(self: &Rc<Self>) -> Result<(), WpViewportError> {
|
||||
if self.surface.viewporter.get().is_some() {
|
||||
if self.surface.viewporter.is_some() {
|
||||
return Err(WpViewportError::ViewportExists);
|
||||
}
|
||||
self.surface.viewporter.set(Some(self.clone()));
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ impl SurfaceExt for XSurface {
|
|||
}
|
||||
|
||||
fn on_surface_destroy(&self) -> Result<(), WlSurfaceError> {
|
||||
if self.xwayland_surface.get().is_some() {
|
||||
if self.xwayland_surface.is_some() {
|
||||
return Err(WlSurfaceError::ReloObjectStillExists);
|
||||
}
|
||||
self.surface.unset_ext();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ use {
|
|||
ifs::wl_surface::{x_surface::XSurface, WlSurfaceError},
|
||||
leaks::Tracker,
|
||||
object::Object,
|
||||
utils::buffd::{MsgParser, MsgParserError},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
cell_ext::CellExt,
|
||||
},
|
||||
wire::{xwayland_surface_v1::*, XwaylandSurfaceV1Id},
|
||||
},
|
||||
std::rc::Rc,
|
||||
|
|
@ -21,7 +24,7 @@ pub struct XwaylandSurfaceV1 {
|
|||
impl XwaylandSurfaceV1 {
|
||||
fn set_serial(&self, parser: MsgParser<'_, '_>) -> Result<(), XwaylandSurfaceV1Error> {
|
||||
let req: SetSerial = self.client.parse(self, parser)?;
|
||||
if self.x.surface.xwayland_serial.get().is_some() {
|
||||
if self.x.surface.xwayland_serial.is_some() {
|
||||
return Err(XwaylandSurfaceV1Error::SerialAlreadySet);
|
||||
}
|
||||
let serial = req.serial_lo as u64 | ((req.serial_hi as u64) << 32);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ impl Xwindow {
|
|||
surface: &Rc<WlSurface>,
|
||||
) -> Result<Rc<Self>, XWindowError> {
|
||||
let xsurface = surface.get_xsurface()?;
|
||||
if xsurface.xwindow.get().is_some() {
|
||||
if xsurface.xwindow.is_some() {
|
||||
return Err(XWindowError::AlreadyAttached);
|
||||
}
|
||||
let tld = ToplevelData::new(
|
||||
|
|
@ -235,11 +235,11 @@ impl Xwindow {
|
|||
}
|
||||
|
||||
pub fn is_mapped(&self) -> bool {
|
||||
self.toplevel_data.parent.get().is_some() || self.display_link.borrow_mut().is_some()
|
||||
self.toplevel_data.parent.is_some() || self.display_link.borrow_mut().is_some()
|
||||
}
|
||||
|
||||
pub fn may_be_mapped(&self) -> bool {
|
||||
self.x.surface.buffer.get().is_some() && self.data.info.mapped.get()
|
||||
self.x.surface.buffer.is_some() && self.data.info.mapped.get()
|
||||
}
|
||||
|
||||
fn map_change(&self) -> Change {
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ impl XdgSurface {
|
|||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
|
||||
let _req: Destroy = self.surface.client.parse(self, parser)?;
|
||||
if self.ext.get().is_some() {
|
||||
if self.ext.is_some() {
|
||||
return Err(XdgSurfaceError::RoleNotYetDestroyed(self.id));
|
||||
}
|
||||
{
|
||||
|
|
@ -202,7 +202,7 @@ impl XdgSurface {
|
|||
fn get_toplevel(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
|
||||
let req: GetToplevel = self.surface.client.parse(&**self, parser)?;
|
||||
self.set_role(XdgSurfaceRole::XdgToplevel)?;
|
||||
if self.ext.get().is_some() {
|
||||
if self.ext.is_some() {
|
||||
self.surface.client.protocol_error(
|
||||
&**self,
|
||||
ALREADY_CONSTRUCTED,
|
||||
|
|
@ -232,7 +232,7 @@ impl XdgSurface {
|
|||
parent = Some(self.surface.client.lookup(req.parent)?);
|
||||
}
|
||||
let positioner = self.surface.client.lookup(req.positioner)?;
|
||||
if self.ext.get().is_some() {
|
||||
if self.ext.is_some() {
|
||||
self.surface.client.protocol_error(
|
||||
&**self,
|
||||
ALREADY_CONSTRUCTED,
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ impl XdgSurfaceExt for XdgPopup {
|
|||
};
|
||||
let surface = &self.xdg.surface;
|
||||
let state = &surface.client.state;
|
||||
if surface.buffer.get().is_some() {
|
||||
if surface.buffer.is_some() {
|
||||
if wl.is_none() {
|
||||
self.xdg.set_workspace(&ws);
|
||||
*wl = Some(ws.stacked.add_last(self.clone()));
|
||||
|
|
|
|||
|
|
@ -557,8 +557,8 @@ impl XdgSurfaceExt for XdgToplevel {
|
|||
|
||||
fn post_commit(self: Rc<Self>) {
|
||||
let surface = &self.xdg.surface;
|
||||
if self.toplevel_data.parent.get().is_some() {
|
||||
if surface.buffer.get().is_none() {
|
||||
if self.toplevel_data.parent.is_some() {
|
||||
if surface.buffer.is_none() {
|
||||
self.tl_destroy();
|
||||
{
|
||||
let new_parent = self.parent.get();
|
||||
|
|
@ -569,7 +569,7 @@ impl XdgSurfaceExt for XdgToplevel {
|
|||
}
|
||||
self.state.tree_changed();
|
||||
}
|
||||
} else if surface.buffer.get().is_some() {
|
||||
} else if surface.buffer.is_some() {
|
||||
if let Some(parent) = self.parent.get() {
|
||||
self.map_child(&parent);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ impl XwaylandShellV1 {
|
|||
let req: GetXwaylandSurface = self.client.parse(self, parser)?;
|
||||
let surface = self.client.lookup(req.surface)?;
|
||||
let xsurface = surface.get_xsurface()?;
|
||||
if xsurface.xwayland_surface.get().is_some() {
|
||||
if xsurface.xwayland_surface.is_some() {
|
||||
return Err(XwaylandShellV1Error::AlreadyAttached(surface.id));
|
||||
}
|
||||
let xws = Rc::new(XwaylandSurfaceV1 {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use {
|
|||
utils::{
|
||||
bitflags::BitflagsExt,
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
cell_ext::CellExt,
|
||||
linkedlist::LinkedNode,
|
||||
numcell::NumCell,
|
||||
},
|
||||
|
|
@ -253,7 +254,7 @@ impl ZwlrLayerSurfaceV1 {
|
|||
}
|
||||
self.size.set((width, height));
|
||||
}
|
||||
if self.acked_serial.get().is_none() {
|
||||
if self.acked_serial.is_none() {
|
||||
send_configure = true;
|
||||
}
|
||||
if send_configure {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue