get_registry/common/protocols_data/wayland/
wl_compositor.rs1use super::super::all_types::*;
8use ::wl_client::builder::prelude::*;
9
10static INTERFACE: wl_interface = wl_interface {
11 name: c"wl_compositor".as_ptr(),
12 version: 6,
13 method_count: 2,
14 methods: {
15 static MESSAGES: [wl_message; 2] = [
16 wl_message {
17 name: c"create_surface".as_ptr(),
18 signature: c"n".as_ptr(),
19 types: {
20 static TYPES: [Option<&'static wl_interface>; 1] =
21 [Some(WlSurface::WL_INTERFACE)];
22 TYPES.as_ptr().cast()
23 },
24 },
25 wl_message {
26 name: c"create_region".as_ptr(),
27 signature: c"n".as_ptr(),
28 types: {
29 static TYPES: [Option<&'static wl_interface>; 1] =
30 [Some(WlRegion::WL_INTERFACE)];
31 TYPES.as_ptr().cast()
32 },
33 },
34 ];
35 MESSAGES.as_ptr()
36 },
37 event_count: 0,
38 events: ptr::null(),
39};
40
41#[derive(Clone, Eq, PartialEq)]
45#[repr(transparent)]
46pub struct WlCompositor {
47 proxy: UntypedOwnedProxy,
49}
50
51#[derive(Eq, PartialEq)]
55#[repr(transparent)]
56pub struct WlCompositorRef {
57 proxy: UntypedBorrowedProxy,
59}
60
61unsafe impl UntypedOwnedProxyWrapper for WlCompositor {}
63
64unsafe impl OwnedProxy for WlCompositor {
67 const INTERFACE: &'static str = "wl_compositor";
68 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
69 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
70 private::EventHandler(private::NoOpEventHandler);
71 const MAX_VERSION: u32 = 6;
72
73 type Borrowed = WlCompositorRef;
74 type Api = private::ProxyApi;
75 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
76}
77
78unsafe impl UntypedBorrowedProxyWrapper for WlCompositorRef {}
80
81unsafe impl BorrowedProxy for WlCompositorRef {
83 type Owned = WlCompositor;
84}
85
86impl Deref for WlCompositor {
87 type Target = WlCompositorRef;
88
89 fn deref(&self) -> &Self::Target {
90 proxy::low_level::deref(self)
91 }
92}
93
94mod private {
95 pub struct ProxyApi;
96
97 #[allow(dead_code)]
98 pub struct EventHandler<H>(pub(super) H);
99
100 #[allow(dead_code)]
101 pub struct NoOpEventHandler;
102}
103
104impl Debug for WlCompositor {
105 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
106 write!(f, "wl_compositor#{}", self.proxy.id())
107 }
108}
109
110impl Debug for WlCompositorRef {
111 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
112 write!(f, "wl_compositor#{}", self.proxy.id())
113 }
114}
115
116impl PartialEq<WlCompositorRef> for WlCompositor {
117 fn eq(&self, other: &WlCompositorRef) -> bool {
118 self.proxy == other.proxy
119 }
120}
121
122impl PartialEq<WlCompositor> for WlCompositorRef {
123 fn eq(&self, other: &WlCompositor) -> bool {
124 self.proxy == other.proxy
125 }
126}
127
128#[allow(dead_code)]
129impl WlCompositor {
130 #[allow(dead_code)]
132 pub const REQ__CREATE_SURFACE__SINCE: u32 = 1;
133
134 #[allow(dead_code)]
136 pub const REQ__CREATE_REGION__SINCE: u32 = 1;
137}
138
139#[allow(dead_code)]
140impl WlCompositor {
141 #[inline]
145 pub fn create_surface(&self) -> WlSurface {
146 let mut args = [wl_argument { n: 0 }];
147 let data = unsafe {
152 self.proxy
153 .send_constructor::<false>(0, &mut args, WlSurface::WL_INTERFACE, None)
154 };
155 unsafe { proxy::low_level::from_untyped_owned(data) }
157 }
158
159 #[inline]
163 pub fn create_region(&self) -> WlRegion {
164 let mut args = [wl_argument { n: 0 }];
165 let data = unsafe {
170 self.proxy
171 .send_constructor::<false>(1, &mut args, WlRegion::WL_INTERFACE, None)
172 };
173 unsafe { proxy::low_level::from_untyped_owned(data) }
175 }
176}
177
178#[allow(dead_code)]
179impl WlCompositorRef {
180 #[inline]
188 pub fn create_surface(&self, _queue: &Queue) -> WlSurface {
189 let mut args = [wl_argument { n: 0 }];
190 let data = unsafe {
195 self.proxy
196 .send_constructor(_queue, 0, &mut args, WlSurface::WL_INTERFACE, None)
197 };
198 unsafe { proxy::low_level::from_untyped_owned(data) }
200 }
201
202 #[inline]
210 pub fn create_region(&self, _queue: &Queue) -> WlRegion {
211 let mut args = [wl_argument { n: 0 }];
212 let data = unsafe {
217 self.proxy
218 .send_constructor(_queue, 1, &mut args, WlRegion::WL_INTERFACE, None)
219 };
220 unsafe { proxy::low_level::from_untyped_owned(data) }
222 }
223}
224
225#[allow(dead_code)]
227pub trait WlCompositorEventHandler {
228 type Data: 'static;
229}
230
231impl WlCompositorEventHandler for private::NoOpEventHandler {
232 type Data = ();
233}
234
235unsafe impl<H> EventHandler for private::EventHandler<H>
238where
239 H: WlCompositorEventHandler,
240{
241 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
242
243 #[inline]
244 fn mutable_type() -> Option<(TypeId, &'static str)> {
245 let id = TypeId::of::<H::Data>();
246 let name = std::any::type_name::<H::Data>();
247 Some((id, name))
248 }
249
250 #[allow(unused_variables)]
251 unsafe fn handle_event(
252 &self,
253 queue: &Queue,
254 data: *mut u8,
255 slf: &UntypedBorrowedProxy,
256 opcode: u32,
257 args: *mut wl_argument,
258 ) {
259 invalid_opcode("wl_compositor", opcode);
260 }
261}
262
263impl<H> CreateEventHandler<H> for private::ProxyApi
264where
265 H: WlCompositorEventHandler,
266{
267 type EventHandler = private::EventHandler<H>;
268
269 #[inline]
270 fn create_event_handler(handler: H) -> Self::EventHandler {
271 private::EventHandler(handler)
272 }
273}
274
275pub mod event_handlers {
277 use super::*;
278
279 impl WlCompositor {}
280}