get_registry/common/protocols/wayland/
wl_region.rs1use super::super::all_types::*;
9use ::wl_client::builder::prelude::*;
10
11static INTERFACE: wl_interface = wl_interface {
12 name: c"wl_region".as_ptr(),
13 version: 1,
14 method_count: 3,
15 methods: {
16 static MESSAGES: [wl_message; 3] = [
17 wl_message {
18 name: c"destroy".as_ptr(),
19 signature: c"".as_ptr(),
20 types: {
21 static TYPES: [Option<&'static wl_interface>; 0] = [];
22 TYPES.as_ptr().cast()
23 },
24 },
25 wl_message {
26 name: c"add".as_ptr(),
27 signature: c"iiii".as_ptr(),
28 types: {
29 static TYPES: [Option<&'static wl_interface>; 4] = [None, None, None, None];
30 TYPES.as_ptr().cast()
31 },
32 },
33 wl_message {
34 name: c"subtract".as_ptr(),
35 signature: c"iiii".as_ptr(),
36 types: {
37 static TYPES: [Option<&'static wl_interface>; 4] = [None, None, None, None];
38 TYPES.as_ptr().cast()
39 },
40 },
41 ];
42 MESSAGES.as_ptr()
43 },
44 event_count: 0,
45 events: ptr::null(),
46};
47
48#[derive(Clone, Eq, PartialEq)]
52#[repr(transparent)]
53pub struct WlRegion {
54 proxy: UntypedOwnedProxy,
56}
57
58#[derive(Eq, PartialEq)]
62#[repr(transparent)]
63pub struct WlRegionRef {
64 proxy: UntypedBorrowedProxy,
66}
67
68unsafe impl UntypedOwnedProxyWrapper for WlRegion {}
70
71unsafe impl OwnedProxy for WlRegion {
74 const INTERFACE: &'static str = "wl_region";
75 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
76 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
77 private::EventHandler(private::NoOpEventHandler);
78 const MAX_VERSION: u32 = 1;
79
80 type Borrowed = WlRegionRef;
81 type Api = private::ProxyApi;
82 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
83}
84
85unsafe impl UntypedBorrowedProxyWrapper for WlRegionRef {}
87
88unsafe impl BorrowedProxy for WlRegionRef {
90 type Owned = WlRegion;
91}
92
93impl Deref for WlRegion {
94 type Target = WlRegionRef;
95
96 fn deref(&self) -> &Self::Target {
97 proxy::low_level::deref(self)
98 }
99}
100
101mod private {
102 pub struct ProxyApi;
103
104 #[allow(dead_code)]
105 pub struct EventHandler<H>(pub(super) H);
106
107 #[allow(dead_code)]
108 pub struct NoOpEventHandler;
109}
110
111impl Debug for WlRegion {
112 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
113 write!(f, "wl_region#{}", self.proxy.id())
114 }
115}
116
117impl Debug for WlRegionRef {
118 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
119 write!(f, "wl_region#{}", self.proxy.id())
120 }
121}
122
123impl PartialEq<WlRegionRef> for WlRegion {
124 fn eq(&self, other: &WlRegionRef) -> bool {
125 self.proxy == other.proxy
126 }
127}
128
129impl PartialEq<WlRegion> for WlRegionRef {
130 fn eq(&self, other: &WlRegion) -> bool {
131 self.proxy == other.proxy
132 }
133}
134
135#[allow(dead_code)]
136impl WlRegion {
137 #[allow(dead_code)]
139 pub const REQ__DESTROY__SINCE: u32 = 1;
140
141 #[allow(dead_code)]
143 pub const REQ__ADD__SINCE: u32 = 1;
144
145 #[allow(dead_code)]
147 pub const REQ__SUBTRACT__SINCE: u32 = 1;
148}
149
150#[allow(dead_code)]
151impl WlRegion {
152 #[inline]
156 pub fn destroy(&self) {
157 let mut args = [];
158 unsafe {
162 self.proxy.send_destructor(0, &mut args);
163 }
164 }
165}
166
167#[allow(dead_code)]
168impl WlRegionRef {
169 #[inline]
180 pub fn add(&self, x: i32, y: i32, width: i32, height: i32) {
181 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
182 let mut args = [
183 wl_argument { i: arg0 },
184 wl_argument { i: arg1 },
185 wl_argument { i: arg2 },
186 wl_argument { i: arg3 },
187 ];
188 unsafe {
192 self.proxy.send_request(1, &mut args);
193 }
194 }
195
196 #[inline]
207 pub fn subtract(&self, x: i32, y: i32, width: i32, height: i32) {
208 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
209 let mut args = [
210 wl_argument { i: arg0 },
211 wl_argument { i: arg1 },
212 wl_argument { i: arg2 },
213 wl_argument { i: arg3 },
214 ];
215 unsafe {
219 self.proxy.send_request(2, &mut args);
220 }
221 }
222}
223
224#[allow(dead_code)]
226pub trait WlRegionEventHandler {}
227
228impl WlRegionEventHandler for private::NoOpEventHandler {}
229
230unsafe impl<H> EventHandler for private::EventHandler<H>
232where
233 H: WlRegionEventHandler,
234{
235 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
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}