1
0
Fork 0
forked from wry/wry

wayland: implement xwayland_shell_v1

This commit is contained in:
Julian Orth 2022-10-16 21:14:12 +02:00
parent 1f64fefc86
commit 335677bbcd
11 changed files with 332 additions and 7 deletions

View file

@ -1,6 +1,9 @@
use {
crate::{
ifs::wl_surface::{x_surface::xwindow::Xwindow, SurfaceExt, WlSurface, WlSurfaceError},
ifs::wl_surface::{
x_surface::{xwayland_surface_v1::XwaylandSurfaceV1, xwindow::Xwindow},
SurfaceExt, WlSurface, WlSurfaceError,
},
leaks::Tracker,
tree::ToplevelNode,
utils::clonecell::CloneCell,
@ -9,11 +12,13 @@ use {
std::rc::Rc,
};
pub mod xwayland_surface_v1;
pub mod xwindow;
pub struct XSurface {
pub surface: Rc<WlSurface>,
pub xwindow: CloneCell<Option<Rc<Xwindow>>>,
pub xwayland_surface: CloneCell<Option<Rc<XwaylandSurfaceV1>>>,
pub tracker: Tracker<Self>,
}
@ -25,6 +30,9 @@ impl SurfaceExt for XSurface {
}
fn on_surface_destroy(&self) -> Result<(), WlSurfaceError> {
if self.xwayland_surface.get().is_some() {
return Err(WlSurfaceError::ReloObjectStillExists);
}
self.surface.unset_ext();
if let Some(xwindow) = self.xwindow.take() {
xwindow.tl_destroy();
@ -35,7 +43,10 @@ impl SurfaceExt for XSurface {
.state
.xwayland
.queue
.push(XWaylandEvent::SurfaceDestroyed(self.surface.id));
.push(XWaylandEvent::SurfaceDestroyed(
self.surface.id,
self.surface.xwayland_serial.get(),
));
}
Ok(())
}