wl_client/test_protocols/core/
wl_surface.rs1use {super::super::all_types::*, crate::builder::prelude::*};
2
3static INTERFACE: wl_interface = wl_interface {
4 name: c"wl_surface".as_ptr(),
5 version: 1,
6 method_count: 0,
7 methods: ptr::null(),
8 event_count: 0,
9 events: ptr::null(),
10};
11
12#[derive(Clone, Eq, PartialEq)]
16#[repr(transparent)]
17pub struct WlSurface {
18 proxy: UntypedOwnedProxy,
20}
21
22#[derive(Eq, PartialEq)]
26#[repr(transparent)]
27pub struct WlSurfaceRef {
28 proxy: UntypedBorrowedProxy,
30}
31
32unsafe impl UntypedOwnedProxyWrapper for WlSurface {}
34
35unsafe impl OwnedProxy for WlSurface {
38 const INTERFACE: &'static str = "wl_surface";
39 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
40 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
41 private::EventHandler(private::NoOpEventHandler);
42 const MAX_VERSION: u32 = 1;
43
44 type Borrowed = WlSurfaceRef;
45 type Api = private::ProxyApi;
46 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
47}
48
49unsafe impl UntypedBorrowedProxyWrapper for WlSurfaceRef {}
51
52unsafe impl BorrowedProxy for WlSurfaceRef {
54 type Owned = WlSurface;
55}
56
57impl Deref for WlSurface {
58 type Target = WlSurfaceRef;
59
60 fn deref(&self) -> &Self::Target {
61 proxy::low_level::deref(self)
62 }
63}
64
65mod private {
66 pub struct ProxyApi;
67
68 #[allow(dead_code)]
69 pub struct EventHandler<H>(pub(super) H);
70
71 #[allow(dead_code)]
72 pub struct NoOpEventHandler;
73}
74
75impl Debug for WlSurface {
76 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
77 write!(f, "wl_surface#{}", self.proxy.id())
78 }
79}
80
81impl Debug for WlSurfaceRef {
82 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
83 write!(f, "wl_surface#{}", self.proxy.id())
84 }
85}
86
87impl PartialEq<WlSurfaceRef> for WlSurface {
88 fn eq(&self, other: &WlSurfaceRef) -> bool {
89 self.proxy == other.proxy
90 }
91}
92
93impl PartialEq<WlSurface> for WlSurfaceRef {
94 fn eq(&self, other: &WlSurface) -> bool {
95 self.proxy == other.proxy
96 }
97}
98
99#[allow(dead_code)]
101pub trait WlSurfaceEventHandler {}
102
103impl WlSurfaceEventHandler for private::NoOpEventHandler {}
104
105unsafe impl<H> EventHandler for private::EventHandler<H>
107where
108 H: WlSurfaceEventHandler,
109{
110 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
111
112 #[allow(unused_variables)]
113 unsafe fn handle_event(
114 &self,
115 queue: &Queue,
116 slf: &UntypedBorrowedProxy,
117 opcode: u32,
118 args: *mut wl_argument,
119 ) {
120 invalid_opcode("wl_surface", opcode);
121 }
122}
123
124impl<H> CreateEventHandler<H> for private::ProxyApi
125where
126 H: WlSurfaceEventHandler,
127{
128 type EventHandler = private::EventHandler<H>;
129
130 #[inline]
131 fn create_event_handler(handler: H) -> Self::EventHandler {
132 private::EventHandler(handler)
133 }
134}
135
136pub mod event_handlers {
138 use super::*;
139
140 impl WlSurface {}
141}