1
0
Fork 0
forked from wry/wry

autocommit 2022-01-29 00:49:52 CET

This commit is contained in:
Julian Orth 2022-01-29 00:49:52 +01:00
parent b11a36729c
commit 85b019101a
41 changed files with 1322 additions and 61 deletions

View file

@ -334,9 +334,7 @@ impl WlSurface {
if let Some(buffer_change) = self.pending.buffer.take() {
let mut old_size = None;
let mut new_size = None;
log::info!("changing buffer");
if let Some(buffer) = self.buffer.take() {
log::info!("releasing buffer {}", buffer.id());
old_size = Some(buffer.rect);
self.client.event(buffer.release());
buffer.surfaces.remove(&self.id);

View file

@ -53,6 +53,14 @@ struct PendingXdgSurfaceData {
}
trait XdgSurfaceExt {
fn initial_configure(self: Rc<Self>) {
// nothing
}
fn pre_commit(self: Rc<Self>) {
// nothing
}
fn post_commit(self: Rc<Self>) {
// nothing
}
@ -243,6 +251,9 @@ impl SurfaceExt for XdgSurface {
let rse = self.requested_serial.get();
if ase != Some(rse) {
if ase.is_none() {
if let Some(ext) = self.ext.get() {
ext.initial_configure();
}
self.surface.client.event(self.configure(rse));
}
// return CommitAction::AbortCommit;

View file

@ -25,37 +25,39 @@ id!(XdgPopupId);
pub struct XdgPopup {
id: XdgPopupId,
node_id: PopupId,
pub(in super::super) surface: Rc<XdgSurface>,
pub(in super::super) xdg: Rc<XdgSurface>,
pub(super) parent: CloneCell<Option<Rc<XdgSurface>>>,
}
impl XdgPopup {
pub fn new(id: XdgPopupId, surface: &Rc<XdgSurface>, parent: Option<&Rc<XdgSurface>>) -> Self {
pub fn new(id: XdgPopupId, xdg: &Rc<XdgSurface>, parent: Option<&Rc<XdgSurface>>) -> Self {
Self {
id,
node_id: surface.surface.client.state.node_ids.next(),
surface: surface.clone(),
node_id: xdg.surface.client.state.node_ids.next(),
xdg: xdg.clone(),
parent: CloneCell::new(parent.cloned()),
}
}
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
let _req: Destroy = self.surface.surface.client.parse(self, parser)?;
let _req: Destroy = self.xdg.surface.client.parse(self, parser)?;
{
if let Some(parent) = self.parent.take() {
parent.popups.remove(&self.id);
}
}
self.xdg.ext.set(None);
self.xdg.surface.client.remove_obj(self)?;
Ok(())
}
fn grab(&self, parser: MsgParser<'_, '_>) -> Result<(), GrabError> {
let _req: Grab = self.surface.surface.client.parse(self, parser)?;
let _req: Grab = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}
fn reposition(&self, parser: MsgParser<'_, '_>) -> Result<(), RepositionError> {
let _req: Reposition = self.surface.surface.client.parse(self, parser)?;
let _req: Reposition = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}

View file

@ -387,6 +387,10 @@ impl Node for XdgToplevel {
}
impl XdgSurfaceExt for XdgToplevel {
fn initial_configure(self: Rc<Self>) {
self.xdg.surface.client.event(self.configure(0, 0));
}
fn post_commit(self: Rc<Self>) {
let surface = &self.xdg.surface;
if let Some(parent) = self.parent_node.get() {