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