Merge pull request #84 from Smithay/vberger/xdg_toplevel_close

shell: add method to send close events
This commit is contained in:
Victor Brekenfeld 2018-03-25 15:03:05 +02:00 committed by GitHub
commit 879e2058cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -615,6 +615,18 @@ where
configured
}
/// Send a "close" event to the client
pub fn send_close(&self) -> EventResult<()> {
if !self.alive() {
return EventResult::Destroyed;
}
match self.shell_surface {
SurfaceKind::Wl(_) => EventResult::Sent(()),
SurfaceKind::XdgToplevel(ref s) => s.close(),
SurfaceKind::XdgPopup(_) => unreachable!(),
}
}
/// Access the underlying `wl_surface` of this toplevel surface
///
/// Returns `None` if the toplevel surface actually no longer exists.