simple_window/common/protocols_data/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 type Data: 'static;
222}
223
224impl WpViewporterEventHandler for private::NoOpEventHandler {
225 type Data = ();
226}
227
228unsafe impl<H> EventHandler for private::EventHandler<H>
231where
232 H: WpViewporterEventHandler,
233{
234 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
235
236 #[inline]
237 fn mutable_type() -> Option<(TypeId, &'static str)> {
238 let id = TypeId::of::<H::Data>();
239 let name = std::any::type_name::<H::Data>();
240 Some((id, name))
241 }
242
243 #[allow(unused_variables)]
244 unsafe fn handle_event(
245 &self,
246 queue: &Queue,
247 data: *mut u8,
248 slf: &UntypedBorrowedProxy,
249 opcode: u32,
250 args: *mut wl_argument,
251 ) {
252 invalid_opcode("wp_viewporter", opcode);
253 }
254}
255
256impl<H> CreateEventHandler<H> for private::ProxyApi
257where
258 H: WpViewporterEventHandler,
259{
260 type EventHandler = private::EventHandler<H>;
261
262 #[inline]
263 fn create_event_handler(handler: H) -> Self::EventHandler {
264 private::EventHandler(handler)
265 }
266}
267
268impl WpViewporter {
269 #[allow(dead_code)]
271 pub const ENM__ERROR_VIEWPORT_EXISTS__SINCE: u32 = 1;
272}
273
274#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
275#[allow(dead_code)]
276pub struct WpViewporterError(pub u32);
277
278impl WpViewporterError {
279 #[allow(dead_code)]
281 pub const VIEWPORT_EXISTS: Self = Self(0);
282}
283
284impl Debug for WpViewporterError {
285 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
286 let name = match *self {
287 Self::VIEWPORT_EXISTS => "VIEWPORT_EXISTS",
288 _ => return Debug::fmt(&self.0, f),
289 };
290 f.write_str(name)
291 }
292}
293
294pub mod event_handlers {
296 use super::*;
297
298 impl WpViewporter {}
299}