simple_window/common/protocols_data/wayland/
wl_shell.rs1use {super::super::all_types::*, ::wl_client::builder::prelude::*};
14
15static INTERFACE: wl_interface = wl_interface {
16 name: c"wl_shell".as_ptr(),
17 version: 1,
18 method_count: 1,
19 methods: {
20 static MESSAGES: [wl_message; 1] = [wl_message {
21 name: c"get_shell_surface".as_ptr(),
22 signature: c"no".as_ptr(),
23 types: {
24 static TYPES: [Option<&'static wl_interface>; 2] = [
25 Some(WlShellSurface::WL_INTERFACE),
26 Some(WlSurface::WL_INTERFACE),
27 ];
28 TYPES.as_ptr().cast()
29 },
30 }];
31 MESSAGES.as_ptr()
32 },
33 event_count: 0,
34 events: ptr::null(),
35};
36
37#[derive(Clone, Eq, PartialEq)]
41#[repr(transparent)]
42pub struct WlShell {
43 proxy: UntypedOwnedProxy,
45}
46
47#[derive(Eq, PartialEq)]
51#[repr(transparent)]
52pub struct WlShellRef {
53 proxy: UntypedBorrowedProxy,
55}
56
57unsafe impl UntypedOwnedProxyWrapper for WlShell {}
59
60unsafe impl OwnedProxy for WlShell {
63 const INTERFACE: &'static str = "wl_shell";
64 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
65 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
66 private::EventHandler(private::NoOpEventHandler);
67 const MAX_VERSION: u32 = 1;
68
69 type Borrowed = WlShellRef;
70 type Api = private::ProxyApi;
71 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
72}
73
74unsafe impl UntypedBorrowedProxyWrapper for WlShellRef {}
76
77unsafe impl BorrowedProxy for WlShellRef {
79 type Owned = WlShell;
80}
81
82impl Deref for WlShell {
83 type Target = WlShellRef;
84
85 fn deref(&self) -> &Self::Target {
86 proxy::low_level::deref(self)
87 }
88}
89
90mod private {
91 pub struct ProxyApi;
92
93 #[allow(dead_code)]
94 pub struct EventHandler<H>(pub(super) H);
95
96 #[allow(dead_code)]
97 pub struct NoOpEventHandler;
98}
99
100impl Debug for WlShell {
101 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
102 write!(f, "wl_shell#{}", self.proxy.id())
103 }
104}
105
106impl Debug for WlShellRef {
107 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
108 write!(f, "wl_shell#{}", self.proxy.id())
109 }
110}
111
112impl PartialEq<WlShellRef> for WlShell {
113 fn eq(&self, other: &WlShellRef) -> bool {
114 self.proxy == other.proxy
115 }
116}
117
118impl PartialEq<WlShell> for WlShellRef {
119 fn eq(&self, other: &WlShell) -> bool {
120 self.proxy == other.proxy
121 }
122}
123
124#[allow(dead_code)]
125impl WlShell {
126 #[allow(dead_code)]
128 pub const REQ__GET_SHELL_SURFACE__SINCE: u32 = 1;
129
130 #[inline]
142 pub fn get_shell_surface(&self, surface: &WlSurfaceRef) -> WlShellSurface {
143 let (arg1,) = (surface,);
144 let obj1_lock = proxy::lock(arg1);
145 let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
146 let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
147 let data = unsafe {
152 self.proxy
153 .send_constructor::<false>(0, &mut args, WlShellSurface::WL_INTERFACE, None)
154 };
155 unsafe { proxy::low_level::from_untyped_owned(data) }
157 }
158}
159
160#[allow(dead_code)]
161impl WlShellRef {
162 #[inline]
175 pub fn get_shell_surface(&self, _queue: &Queue, surface: &WlSurfaceRef) -> WlShellSurface {
176 let (arg1,) = (surface,);
177 let obj1_lock = proxy::lock(arg1);
178 let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
179 let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
180 let data = unsafe {
185 self.proxy
186 .send_constructor(_queue, 0, &mut args, WlShellSurface::WL_INTERFACE, None)
187 };
188 unsafe { proxy::low_level::from_untyped_owned(data) }
190 }
191}
192
193#[allow(dead_code)]
195pub trait WlShellEventHandler {
196 type Data: 'static;
197}
198
199impl WlShellEventHandler for private::NoOpEventHandler {
200 type Data = ();
201}
202
203unsafe impl<H> EventHandler for private::EventHandler<H>
206where
207 H: WlShellEventHandler,
208{
209 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
210
211 #[inline]
212 fn mutable_type() -> Option<(TypeId, &'static str)> {
213 let id = TypeId::of::<H::Data>();
214 let name = std::any::type_name::<H::Data>();
215 Some((id, name))
216 }
217
218 #[allow(unused_variables)]
219 unsafe fn handle_event(
220 &self,
221 queue: &Queue,
222 data: *mut u8,
223 slf: &UntypedBorrowedProxy,
224 opcode: u32,
225 args: *mut wl_argument,
226 ) {
227 invalid_opcode("wl_shell", opcode);
228 }
229}
230
231impl<H> CreateEventHandler<H> for private::ProxyApi
232where
233 H: WlShellEventHandler,
234{
235 type EventHandler = private::EventHandler<H>;
236
237 #[inline]
238 fn create_event_handler(handler: H) -> Self::EventHandler {
239 private::EventHandler(handler)
240 }
241}
242
243impl WlShell {
244 #[allow(dead_code)]
246 pub const ENM__ERROR_ROLE__SINCE: u32 = 1;
247}
248
249#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
250#[allow(dead_code)]
251pub struct WlShellError(pub u32);
252
253impl WlShellError {
254 #[allow(dead_code)]
256 pub const ROLE: Self = Self(0);
257}
258
259impl Debug for WlShellError {
260 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
261 let name = match *self {
262 Self::ROLE => "ROLE",
263 _ => return Debug::fmt(&self.0, f),
264 };
265 f.write_str(name)
266 }
267}
268
269pub mod event_handlers {
271 use super::*;
272
273 impl WlShell {}
274}