get_registry/common/protocols_data/viewporter/
wp_viewporter.rs1use super::super::all_types::*;
11use ::wl_client::builder::prelude::*;
12
13static INTERFACE: wl_interface = wl_interface {
14 name: c"wp_viewporter".as_ptr(),
15 version: 1,
16 method_count: 2,
17 methods: {
18 static MESSAGES: [wl_message; 2] = [
19 wl_message {
20 name: c"destroy".as_ptr(),
21 signature: c"".as_ptr(),
22 types: {
23 static TYPES: [Option<&'static wl_interface>; 0] = [];
24 TYPES.as_ptr().cast()
25 },
26 },
27 wl_message {
28 name: c"get_viewport".as_ptr(),
29 signature: c"no".as_ptr(),
30 types: {
31 static TYPES: [Option<&'static wl_interface>; 2] = [
32 Some(WpViewport::WL_INTERFACE),
33 Some(WlSurface::WL_INTERFACE),
34 ];
35 TYPES.as_ptr().cast()
36 },
37 },
38 ];
39 MESSAGES.as_ptr()
40 },
41 event_count: 0,
42 events: ptr::null(),
43};
44
45#[derive(Clone, Eq, PartialEq)]
49#[repr(transparent)]
50pub struct WpViewporter {
51 proxy: UntypedOwnedProxy,
53}
54
55#[derive(Eq, PartialEq)]
59#[repr(transparent)]
60pub struct WpViewporterRef {
61 proxy: UntypedBorrowedProxy,
63}
64
65unsafe impl UntypedOwnedProxyWrapper for WpViewporter {}
67
68unsafe impl OwnedProxy for WpViewporter {
71 const INTERFACE: &'static str = "wp_viewporter";
72 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
73 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
74 private::EventHandler(private::NoOpEventHandler);
75 const MAX_VERSION: u32 = 1;
76
77 type Borrowed = WpViewporterRef;
78 type Api = private::ProxyApi;
79 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
80}
81
82unsafe impl UntypedBorrowedProxyWrapper for WpViewporterRef {}
84
85unsafe impl BorrowedProxy for WpViewporterRef {
87 type Owned = WpViewporter;
88}
89
90impl Deref for WpViewporter {
91 type Target = WpViewporterRef;
92
93 fn deref(&self) -> &Self::Target {
94 proxy::low_level::deref(self)
95 }
96}
97
98mod private {
99 pub struct ProxyApi;
100
101 #[allow(dead_code)]
102 pub struct EventHandler<H>(pub(super) H);
103
104 #[allow(dead_code)]
105 pub struct NoOpEventHandler;
106}
107
108impl Debug for WpViewporter {
109 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
110 write!(f, "wp_viewporter#{}", self.proxy.id())
111 }
112}
113
114impl Debug for WpViewporterRef {
115 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
116 write!(f, "wp_viewporter#{}", self.proxy.id())
117 }
118}
119
120impl PartialEq<WpViewporterRef> for WpViewporter {
121 fn eq(&self, other: &WpViewporterRef) -> bool {
122 self.proxy == other.proxy
123 }
124}
125
126impl PartialEq<WpViewporter> for WpViewporterRef {
127 fn eq(&self, other: &WpViewporter) -> bool {
128 self.proxy == other.proxy
129 }
130}
131
132#[allow(dead_code)]
133impl WpViewporter {
134 #[allow(dead_code)]
136 pub const REQ__DESTROY__SINCE: u32 = 1;
137
138 #[allow(dead_code)]
140 pub const REQ__GET_VIEWPORT__SINCE: u32 = 1;
141}
142
143#[allow(dead_code)]
144impl WpViewporter {
145 #[inline]
151 pub fn destroy(&self) {
152 let mut args = [];
153 unsafe {
157 self.proxy.send_destructor(0, &mut args);
158 }
159 }
160
161 #[inline]
172 pub fn get_viewport(&self, surface: &WlSurfaceRef) -> WpViewport {
173 let (arg1,) = (surface,);
174 let obj1_lock = proxy::lock(arg1);
175 let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
176 let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
177 let data = unsafe {
182 self.proxy
183 .send_constructor::<false>(1, &mut args, WpViewport::WL_INTERFACE, None)
184 };
185 unsafe { proxy::low_level::from_untyped_owned(data) }
187 }
188}
189
190#[allow(dead_code)]
191impl WpViewporterRef {
192 #[inline]
204 pub fn get_viewport(&self, _queue: &Queue, surface: &WlSurfaceRef) -> WpViewport {
205 let (arg1,) = (surface,);
206 let obj1_lock = proxy::lock(arg1);
207 let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
208 let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
209 let data = unsafe {
214 self.proxy
215 .send_constructor(_queue, 1, &mut args, WpViewport::WL_INTERFACE, None)
216 };
217 unsafe { proxy::low_level::from_untyped_owned(data) }
219 }
220}
221
222#[allow(dead_code)]
224pub trait WpViewporterEventHandler {
225 type Data: 'static;
226}
227
228impl WpViewporterEventHandler for private::NoOpEventHandler {
229 type Data = ();
230}
231
232unsafe impl<H> EventHandler for private::EventHandler<H>
235where
236 H: WpViewporterEventHandler,
237{
238 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
239
240 #[inline]
241 fn mutable_type() -> Option<(TypeId, &'static str)> {
242 let id = TypeId::of::<H::Data>();
243 let name = std::any::type_name::<H::Data>();
244 Some((id, name))
245 }
246
247 #[allow(unused_variables)]
248 unsafe fn handle_event(
249 &self,
250 queue: &Queue,
251 data: *mut u8,
252 slf: &UntypedBorrowedProxy,
253 opcode: u32,
254 args: *mut wl_argument,
255 ) {
256 invalid_opcode("wp_viewporter", opcode);
257 }
258}
259
260impl<H> CreateEventHandler<H> for private::ProxyApi
261where
262 H: WpViewporterEventHandler,
263{
264 type EventHandler = private::EventHandler<H>;
265
266 #[inline]
267 fn create_event_handler(handler: H) -> Self::EventHandler {
268 private::EventHandler(handler)
269 }
270}
271
272impl WpViewporter {
273 #[allow(dead_code)]
275 pub const ENM__ERROR_VIEWPORT_EXISTS__SINCE: u32 = 1;
276}
277
278#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
279#[allow(dead_code)]
280pub struct WpViewporterError(pub u32);
281
282impl WpViewporterError {
283 #[allow(dead_code)]
285 pub const VIEWPORT_EXISTS: Self = Self(0);
286}
287
288impl Debug for WpViewporterError {
289 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
290 let name = match *self {
291 Self::VIEWPORT_EXISTS => "VIEWPORT_EXISTS",
292 _ => return Debug::fmt(&self.0, f),
293 };
294 f.write_str(name)
295 }
296}
297
298pub mod event_handlers {
300 use super::*;
301
302 impl WpViewporter {}
303}