1 //! Implementations of the Wayland backends using the system `libwayland`
2 
3 use crate::protocol::ArgumentType;
4 use wayland_sys::common::{wl_argument, wl_array};
5 
6 #[cfg(any(test, feature = "client_system"))]
7 pub mod client;
8 #[cfg(any(test, feature = "server_system"))]
9 pub mod server;
10 
11 /// Magic static for wayland objects managed by wayland-client or wayland-server
12 ///
13 /// This static serves no purpose other than existing at a stable address.
14 static RUST_MANAGED: u8 = 42;
15 
free_arrays(signature: &[ArgumentType], arglist: &[wl_argument])16 unsafe fn free_arrays(signature: &[ArgumentType], arglist: &[wl_argument]) {
17     for (typ, arg) in signature.iter().zip(arglist.iter()) {
18         if let ArgumentType::Array(_) = typ {
19             let _ = Box::from_raw(arg.a as *mut wl_array);
20         }
21     }
22 }
23