Skip to main content

get_registry/common/protocols/wayland/
wl_fixes.rs

1//! wayland protocol fixes
2//!
3//! This global fixes problems with other core-protocol interfaces that
4//! cannot be fixed in these interfaces themselves.
5
6use super::super::all_types::*;
7use ::wl_client::builder::prelude::*;
8
9static INTERFACE: wl_interface = wl_interface {
10    name: c"wl_fixes".as_ptr(),
11    version: 1,
12    method_count: 2,
13    methods: {
14        static MESSAGES: [wl_message; 2] = [
15            wl_message {
16                name: c"destroy".as_ptr(),
17                signature: c"".as_ptr(),
18                types: {
19                    static TYPES: [Option<&'static wl_interface>; 0] = [];
20                    TYPES.as_ptr().cast()
21                },
22            },
23            wl_message {
24                name: c"destroy_registry".as_ptr(),
25                signature: c"o".as_ptr(),
26                types: {
27                    static TYPES: [Option<&'static wl_interface>; 1] =
28                        [Some(WlRegistry::WL_INTERFACE)];
29                    TYPES.as_ptr().cast()
30                },
31            },
32        ];
33        MESSAGES.as_ptr()
34    },
35    event_count: 0,
36    events: ptr::null(),
37};
38
39/// An owned wl_fixes proxy.
40///
41/// See the documentation of [the module][self] for the interface description.
42#[derive(Clone, Eq, PartialEq)]
43#[repr(transparent)]
44pub struct WlFixes {
45    /// This proxy has the interface INTERFACE.
46    proxy: UntypedOwnedProxy,
47}
48
49/// A borrowed wl_fixes proxy.
50///
51/// See the documentation of [the module][self] for the interface description.
52#[derive(Eq, PartialEq)]
53#[repr(transparent)]
54pub struct WlFixesRef {
55    /// This proxy has the interface INTERFACE.
56    proxy: UntypedBorrowedProxy,
57}
58
59// SAFETY: WlFixes is a transparent wrapper around UntypedOwnedProxy
60unsafe impl UntypedOwnedProxyWrapper for WlFixes {}
61
62// SAFETY: - INTERFACE is a valid wl_interface
63//         - The only invariant is that self.proxy has a compatible interface
64unsafe impl OwnedProxy for WlFixes {
65    const INTERFACE: &'static str = "wl_fixes";
66    const WL_INTERFACE: &'static wl_interface = &INTERFACE;
67    const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
68        private::EventHandler(private::NoOpEventHandler);
69    const MAX_VERSION: u32 = 1;
70
71    type Borrowed = WlFixesRef;
72    type Api = private::ProxyApi;
73    type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
74}
75
76// SAFETY: WlFixesRef is a transparent wrapper around UntypedBorrowedProxy
77unsafe impl UntypedBorrowedProxyWrapper for WlFixesRef {}
78
79// SAFETY: - The only invariant is that self.proxy has a compatible interface
80unsafe impl BorrowedProxy for WlFixesRef {
81    type Owned = WlFixes;
82}
83
84impl Deref for WlFixes {
85    type Target = WlFixesRef;
86
87    fn deref(&self) -> &Self::Target {
88        proxy::low_level::deref(self)
89    }
90}
91
92mod private {
93    pub struct ProxyApi;
94
95    #[allow(dead_code)]
96    pub struct EventHandler<H>(pub(super) H);
97
98    #[allow(dead_code)]
99    pub struct NoOpEventHandler;
100}
101
102impl Debug for WlFixes {
103    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
104        write!(f, "wl_fixes#{}", self.proxy.id())
105    }
106}
107
108impl Debug for WlFixesRef {
109    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
110        write!(f, "wl_fixes#{}", self.proxy.id())
111    }
112}
113
114impl PartialEq<WlFixesRef> for WlFixes {
115    fn eq(&self, other: &WlFixesRef) -> bool {
116        self.proxy == other.proxy
117    }
118}
119
120impl PartialEq<WlFixes> for WlFixesRef {
121    fn eq(&self, other: &WlFixes) -> bool {
122        self.proxy == other.proxy
123    }
124}
125
126#[allow(dead_code)]
127impl WlFixes {
128    /// Since when the destroy request is available.
129    #[allow(dead_code)]
130    pub const REQ__DESTROY__SINCE: u32 = 1;
131
132    /// Since when the destroy_registry request is available.
133    #[allow(dead_code)]
134    pub const REQ__DESTROY_REGISTRY__SINCE: u32 = 1;
135}
136
137#[allow(dead_code)]
138impl WlFixes {
139    /// destroys this object
140    #[inline]
141    pub fn destroy(&self) {
142        let mut args = [];
143        // SAFETY: - self.proxy has the interface INTERFACE
144        //         - 0 < INTERFACE.method_count = 2
145        //         - the request signature is ``
146        unsafe {
147            self.proxy.send_destructor(0, &mut args);
148        }
149    }
150}
151
152#[allow(dead_code)]
153impl WlFixesRef {
154    /// destroy a wl_registry
155    ///
156    /// This request destroys a wl_registry object.
157    ///
158    /// The client should no longer use the wl_registry after making this
159    /// request.
160    ///
161    /// The compositor will emit a wl_display.delete_id event with the object ID
162    /// of the registry and will no longer emit any events on the registry. The
163    /// client should re-use the object ID once it receives the
164    /// wl_display.delete_id event.
165    ///
166    /// # Arguments
167    ///
168    /// - `registry`: the registry to destroy
169    #[inline]
170    pub fn destroy_registry(&self, registry: &WlRegistryRef) {
171        let (arg0,) = (registry,);
172        let obj0_lock = proxy::lock(arg0);
173        let obj0 = check_argument_proxy("registry", obj0_lock.wl_proxy());
174        let mut args = [wl_argument { o: obj0 }];
175        // SAFETY: - self.proxy has the interface INTERFACE
176        //         - 1 < INTERFACE.method_count = 2
177        //         - the request signature is `o`
178        unsafe {
179            self.proxy.send_request(1, &mut args);
180        }
181    }
182}
183
184/// An event handler for [WlFixes] proxies.
185#[allow(dead_code)]
186pub trait WlFixesEventHandler {}
187
188impl WlFixesEventHandler for private::NoOpEventHandler {}
189
190// SAFETY: - INTERFACE is a valid wl_interface
191unsafe impl<H> EventHandler for private::EventHandler<H>
192where
193    H: WlFixesEventHandler,
194{
195    const WL_INTERFACE: &'static wl_interface = &INTERFACE;
196
197    #[allow(unused_variables)]
198    unsafe fn handle_event(
199        &self,
200        queue: &Queue,
201        data: *mut u8,
202        slf: &UntypedBorrowedProxy,
203        opcode: u32,
204        args: *mut wl_argument,
205    ) {
206        invalid_opcode("wl_fixes", opcode);
207    }
208}
209
210impl<H> CreateEventHandler<H> for private::ProxyApi
211where
212    H: WlFixesEventHandler,
213{
214    type EventHandler = private::EventHandler<H>;
215
216    #[inline]
217    fn create_event_handler(handler: H) -> Self::EventHandler {
218        private::EventHandler(handler)
219    }
220}
221
222/// Functional event handlers.
223pub mod event_handlers {
224    use super::*;
225
226    impl WlFixes {}
227}