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