simple_window/common/protocols/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
216impl WlRegionEventHandler for private::NoOpEventHandler {}
217
218unsafe impl<H> EventHandler for private::EventHandler<H>
220where
221 H: WlRegionEventHandler,
222{
223 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
224
225 #[allow(unused_variables)]
226 unsafe fn handle_event(
227 &self,
228 queue: &Queue,
229 data: *mut u8,
230 slf: &UntypedBorrowedProxy,
231 opcode: u32,
232 args: *mut wl_argument,
233 ) {
234 invalid_opcode("wl_region", opcode);
235 }
236}
237
238impl<H> CreateEventHandler<H> for private::ProxyApi
239where
240 H: WlRegionEventHandler,
241{
242 type EventHandler = private::EventHandler<H>;
243
244 #[inline]
245 fn create_event_handler(handler: H) -> Self::EventHandler {
246 private::EventHandler(handler)
247 }
248}
249
250pub mod event_handlers {
252 use super::*;
253
254 impl WlRegion {}
255}