x11: add nested x11 backend
This commit is contained in:
parent
2698c06f50
commit
74a4ed1058
7 changed files with 470 additions and 29 deletions
20
src/utils.rs
Normal file
20
src/utils.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use smithay::reexports::wayland_server::{Global, Interface, Resource};
|
||||
use std::convert::{AsRef, From};
|
||||
|
||||
pub struct GlobalDrop<I: Interface + AsRef<Resource<I>> + From<Resource<I>>>(Option<Global<I>>);
|
||||
|
||||
impl<I: Interface + AsRef<Resource<I>> + From<Resource<I>>> From<Global<I>> for GlobalDrop<I> {
|
||||
fn from(g: Global<I>) -> GlobalDrop<I> {
|
||||
GlobalDrop(Some(g))
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: Interface + AsRef<Resource<I>> + From<Resource<I>>> Drop for GlobalDrop<I> {
|
||||
fn drop(&mut self) {
|
||||
if let Some(global) = self.0.take() {
|
||||
global.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue