simple_window/common/protocols/viewporter/
wp_viewporter.rs1use {super::super::all_types::*, ::wl_client::builder::prelude::*};
11
12static INTERFACE: wl_interface = wl_interface {
13 name: c"wp_viewporter".as_ptr(),
14 version: 1,
15 method_count: 2,
16 methods: {
17 static MESSAGES: [wl_message; 2] = [
18 wl_message {
19 name: c"destroy".as_ptr(),
20 signature: c"".as_ptr(),
21 types: {
22 static TYPES: [Option<&'static wl_interface>; 0] = [];
23 TYPES.as_ptr().cast()
24 },
25 },
26 wl_message {
27 name: c"get_viewport".as_ptr(),
28 signature: c"no".as_ptr(),
29 types: {
30 static TYPES: [Option<&'static wl_interface>; 2] = [
31 Some(WpViewport::WL_INTERFACE),
32 Some(WlSurface::WL_INTERFACE),
33 ];
34 TYPES.as_ptr().cast()
35 },
36 },
37 ];
38 MESSAGES.as_ptr()
39 },
40 event_count: 0,
41 events: ptr::null(),
42};
43
44#[derive(Clone, Eq, PartialEq)]
48#[repr(transparent)]
49pub struct WpViewporter {
50 proxy: UntypedOwnedProxy,
52}
53
54#[derive(Eq, PartialEq)]
58#[repr(transparent)]
59pub struct WpViewporterRef {
60 proxy: UntypedBorrowedProxy,
62}
63
64unsafe impl UntypedOwnedProxyWrapper for WpViewporter {}
66
67unsafe impl OwnedProxy for WpViewporter {
70 const INTERFACE: &'static str = "wp_viewporter";
71 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
72 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
73 private::EventHandler(private::NoOpEventHandler);
74 const MAX_VERSION: u32 = 1;
75
76 type Borrowed = WpViewporterRef;
77 type Api = private::ProxyApi;
78 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
79}
80
81unsafe impl UntypedBorrowedProxyWrapper for WpViewporterRef {}
83
84unsafe impl BorrowedProxy for WpViewporterRef {
86 type Owned = WpViewporter;
87}
88
89impl Deref for WpViewporter {
90 type Target = WpViewporterRef;
91
92 fn deref(&self) -> &Self::Target {
93 proxy::low_level::deref(self)
94 }
95}
96
97mod private {
98 pub struct ProxyApi;
99
100 #[allow(dead_code)]
101 pub struct EventHandler<H>(pub(super) H);
102
103 #[allow(dead_code)]
104 pub struct NoOpEventHandler;
105}
106
107impl Debug for WpViewporter {
108 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
109 write!(f, "wp_viewporter#{}", self.proxy.id())
110 }
111}
112
113impl Debug for WpViewporterRef {
114 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
115 write!(f, "wp_viewporter#{}", self.proxy.id())
116 }
117}
118
119impl PartialEq<WpViewporterRef> for WpViewporter {
120 fn eq(&self, other: &WpViewporterRef) -> bool {
121 self.proxy == other.proxy
122 }
123}
124
125impl PartialEq<WpViewporter> for WpViewporterRef {
126 fn eq(&self, other: &WpViewporter) -> bool {
127 self.proxy == other.proxy
128 }
129}
130
131#[allow(dead_code)]
132impl WpViewporter {
133 #[allow(dead_code)]
135 pub const REQ__DESTROY__SINCE: u32 = 1;
136
137 #[inline]
143 pub fn destroy(&self) {
144 let mut args = [];
145 unsafe {
149 self.proxy.send_destructor(0, &mut args);
150 }
151 }
152
153 #[allow(dead_code)]
155 pub const REQ__GET_VIEWPORT__SINCE: u32 = 1;
156
157 #[inline]
168 pub fn get_viewport(&self, surface: &WlSurfaceRef) -> WpViewport {
169 let (arg1,) = (surface,);
170 let obj1_lock = proxy::lock(arg1);
171 let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
172 let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
173 let data = unsafe {
178 self.proxy
179 .send_constructor::<false>(1, &mut args, WpViewport::WL_INTERFACE, None)
180 };
181 unsafe { proxy::low_level::from_untyped_owned(data) }
183 }
184}
185
186#[allow(dead_code)]
187impl WpViewporterRef {
188 #[inline]
200 pub fn get_viewport(&self, _queue: &Queue, surface: &WlSurfaceRef) -> WpViewport {
201 let (arg1,) = (surface,);
202 let obj1_lock = proxy::lock(arg1);
203 let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
204 let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
205 let data = unsafe {
210 self.proxy
211 .send_constructor(_queue, 1, &mut args, WpViewport::WL_INTERFACE, None)
212 };
213 unsafe { proxy::low_level::from_untyped_owned(data) }
215 }
216}
217
218#[allow(dead_code)]
220pub trait WpViewporterEventHandler {}
221
222impl WpViewporterEventHandler for private::NoOpEventHandler {}
223
224unsafe impl<H> EventHandler for private::EventHandler<H>
226where
227 H: WpViewporterEventHandler,
228{
229 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
230
231 #[allow(unused_variables)]
232 unsafe fn handle_event(
233 &self,
234 queue: &Queue,
235 data: *mut u8,
236 slf: &UntypedBorrowedProxy,
237 opcode: u32,
238 args: *mut wl_argument,
239 ) {
240 invalid_opcode("wp_viewporter", opcode);
241 }
242}
243
244impl<H> CreateEventHandler<H> for private::ProxyApi
245where
246 H: WpViewporterEventHandler,
247{
248 type EventHandler = private::EventHandler<H>;
249
250 #[inline]
251 fn create_event_handler(handler: H) -> Self::EventHandler {
252 private::EventHandler(handler)
253 }
254}
255
256impl WpViewporter {
257 #[allow(dead_code)]
259 pub const ENM__ERROR_VIEWPORT_EXISTS__SINCE: u32 = 1;
260}
261
262#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
263#[allow(dead_code)]
264pub struct WpViewporterError(pub u32);
265
266impl WpViewporterError {
267 #[allow(dead_code)]
269 pub const VIEWPORT_EXISTS: Self = Self(0);
270}
271
272impl Debug for WpViewporterError {
273 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
274 let name = match *self {
275 Self::VIEWPORT_EXISTS => "VIEWPORT_EXISTS",
276 _ => return Debug::fmt(&self.0, f),
277 };
278 f.write_str(name)
279 }
280}
281
282pub mod event_handlers {
284 use super::*;
285
286 impl WpViewporter {}
287}