get_registry/common/protocols/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
201impl WlShellEventHandler for private::NoOpEventHandler {}
202
203unsafe impl<H> EventHandler for private::EventHandler<H>
205where
206 H: WlShellEventHandler,
207{
208 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
209
210 #[allow(unused_variables)]
211 unsafe fn handle_event(
212 &self,
213 queue: &Queue,
214 data: *mut u8,
215 slf: &UntypedBorrowedProxy,
216 opcode: u32,
217 args: *mut wl_argument,
218 ) {
219 invalid_opcode("wl_shell", opcode);
220 }
221}
222
223impl<H> CreateEventHandler<H> for private::ProxyApi
224where
225 H: WlShellEventHandler,
226{
227 type EventHandler = private::EventHandler<H>;
228
229 #[inline]
230 fn create_event_handler(handler: H) -> Self::EventHandler {
231 private::EventHandler(handler)
232 }
233}
234
235impl WlShell {
236 #[allow(dead_code)]
238 pub const ENM__ERROR_ROLE__SINCE: u32 = 1;
239}
240
241#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
242#[allow(dead_code)]
243pub struct WlShellError(pub u32);
244
245impl WlShellError {
246 #[allow(dead_code)]
248 pub const ROLE: Self = Self(0);
249}
250
251impl Debug for WlShellError {
252 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
253 let name = match *self {
254 Self::ROLE => "ROLE",
255 _ => return Debug::fmt(&self.0, f),
256 };
257 f.write_str(name)
258 }
259}
260
261pub mod event_handlers {
263 use super::*;
264
265 impl WlShell {}
266}