simple_window/common/protocols_data/wayland/
wl_region.rs1use {super::super::all_types::*, ::wl_client::builder::prelude::*};
9
10static INTERFACE: wl_interface = wl_interface {
11 name: c"wl_region".as_ptr(),
12 version: 1,
13 method_count: 3,
14 methods: {
15 static MESSAGES: [wl_message; 3] = [
16 wl_message {
17 name: c"destroy".as_ptr(),
18 signature: c"".as_ptr(),
19 types: {
20 static TYPES: [Option<&'static wl_interface>; 0] = [];
21 TYPES.as_ptr().cast()
22 },
23 },
24 wl_message {
25 name: c"add".as_ptr(),
26 signature: c"iiii".as_ptr(),
27 types: {
28 static TYPES: [Option<&'static wl_interface>; 4] = [None, None, None, None];
29 TYPES.as_ptr().cast()
30 },
31 },
32 wl_message {
33 name: c"subtract".as_ptr(),
34 signature: c"iiii".as_ptr(),
35 types: {
36 static TYPES: [Option<&'static wl_interface>; 4] = [None, None, None, None];
37 TYPES.as_ptr().cast()
38 },
39 },
40 ];
41 MESSAGES.as_ptr()
42 },
43 event_count: 0,
44 events: ptr::null(),
45};
46
47#[derive(Clone, Eq, PartialEq)]
51#[repr(transparent)]
52pub struct WlRegion {
53 proxy: UntypedOwnedProxy,
55}
56
57#[derive(Eq, PartialEq)]
61#[repr(transparent)]
62pub struct WlRegionRef {
63 proxy: UntypedBorrowedProxy,
65}
66
67unsafe impl UntypedOwnedProxyWrapper for WlRegion {}
69
70unsafe impl OwnedProxy for WlRegion {
73 const INTERFACE: &'static str = "wl_region";
74 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
75 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
76 private::EventHandler(private::NoOpEventHandler);
77 const MAX_VERSION: u32 = 1;
78
79 type Borrowed = WlRegionRef;
80 type Api = private::ProxyApi;
81 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
82}
83
84unsafe impl UntypedBorrowedProxyWrapper for WlRegionRef {}
86
87unsafe impl BorrowedProxy for WlRegionRef {
89 type Owned = WlRegion;
90}
91
92impl Deref for WlRegion {
93 type Target = WlRegionRef;
94
95 fn deref(&self) -> &Self::Target {
96 proxy::low_level::deref(self)
97 }
98}
99
100mod private {
101 pub struct ProxyApi;
102
103 #[allow(dead_code)]
104 pub struct EventHandler<H>(pub(super) H);
105
106 #[allow(dead_code)]
107 pub struct NoOpEventHandler;
108}
109
110impl Debug for WlRegion {
111 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
112 write!(f, "wl_region#{}", self.proxy.id())
113 }
114}
115
116impl Debug for WlRegionRef {
117 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
118 write!(f, "wl_region#{}", self.proxy.id())
119 }
120}
121
122impl PartialEq<WlRegionRef> for WlRegion {
123 fn eq(&self, other: &WlRegionRef) -> bool {
124 self.proxy == other.proxy
125 }
126}
127
128impl PartialEq<WlRegion> for WlRegionRef {
129 fn eq(&self, other: &WlRegion) -> bool {
130 self.proxy == other.proxy
131 }
132}
133
134#[allow(dead_code)]
135impl WlRegion {
136 #[allow(dead_code)]
138 pub const REQ__DESTROY__SINCE: u32 = 1;
139
140 #[inline]
144 pub fn destroy(&self) {
145 let mut args = [];
146 unsafe {
150 self.proxy.send_destructor(0, &mut args);
151 }
152 }
153}
154
155#[allow(dead_code)]
156impl WlRegionRef {
157 #[inline]
168 pub fn add(&self, x: i32, y: i32, width: i32, height: i32) {
169 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
170 let mut args = [
171 wl_argument { i: arg0 },
172 wl_argument { i: arg1 },
173 wl_argument { i: arg2 },
174 wl_argument { i: arg3 },
175 ];
176 unsafe {
180 self.proxy.send_request(1, &mut args);
181 }
182 }
183
184 #[inline]
195 pub fn subtract(&self, x: i32, y: i32, width: i32, height: i32) {
196 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
197 let mut args = [
198 wl_argument { i: arg0 },
199 wl_argument { i: arg1 },
200 wl_argument { i: arg2 },
201 wl_argument { i: arg3 },
202 ];
203 unsafe {
207 self.proxy.send_request(2, &mut args);
208 }
209 }
210}
211
212#[allow(dead_code)]
214pub trait WlRegionEventHandler {
215 type Data: 'static;
216}
217
218impl WlRegionEventHandler for private::NoOpEventHandler {
219 type Data = ();
220}
221
222unsafe impl<H> EventHandler for private::EventHandler<H>
225where
226 H: WlRegionEventHandler,
227{
228 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
229
230 #[inline]
231 fn mutable_type() -> Option<(TypeId, &'static str)> {
232 let id = TypeId::of::<H::Data>();
233 let name = std::any::type_name::<H::Data>();
234 Some((id, name))
235 }
236
237 #[allow(unused_variables)]
238 unsafe fn handle_event(
239 &self,
240 queue: &Queue,
241 data: *mut u8,
242 slf: &UntypedBorrowedProxy,
243 opcode: u32,
244 args: *mut wl_argument,
245 ) {
246 invalid_opcode("wl_region", opcode);
247 }
248}
249
250impl<H> CreateEventHandler<H> for private::ProxyApi
251where
252 H: WlRegionEventHandler,
253{
254 type EventHandler = private::EventHandler<H>;
255
256 #[inline]
257 fn create_event_handler(handler: H) -> Self::EventHandler {
258 private::EventHandler(handler)
259 }
260}
261
262pub mod event_handlers {
264 use super::*;
265
266 impl WlRegion {}
267}