xref: /aosp_15_r20/external/wayland/tests/data/small-client.h (revision 84e872a0dc482bffdb63672969dd03a827d67c73)
1*84e872a0SLloyd Pique /* SCANNER TEST */
2*84e872a0SLloyd Pique 
3*84e872a0SLloyd Pique #ifndef SMALL_TEST_CLIENT_PROTOCOL_H
4*84e872a0SLloyd Pique #define SMALL_TEST_CLIENT_PROTOCOL_H
5*84e872a0SLloyd Pique 
6*84e872a0SLloyd Pique #include <stdint.h>
7*84e872a0SLloyd Pique #include <stddef.h>
8*84e872a0SLloyd Pique #include "wayland-client.h"
9*84e872a0SLloyd Pique 
10*84e872a0SLloyd Pique #ifdef  __cplusplus
11*84e872a0SLloyd Pique extern "C" {
12*84e872a0SLloyd Pique #endif
13*84e872a0SLloyd Pique 
14*84e872a0SLloyd Pique /**
15*84e872a0SLloyd Pique  * @page page_small_test The small_test protocol
16*84e872a0SLloyd Pique  * @section page_ifaces_small_test Interfaces
17*84e872a0SLloyd Pique  * - @subpage page_iface_intf_A - the thing A
18*84e872a0SLloyd Pique  * @section page_copyright_small_test Copyright
19*84e872a0SLloyd Pique  * <pre>
20*84e872a0SLloyd Pique  *
21*84e872a0SLloyd Pique  * Copyright © 2016 Collabora, Ltd.
22*84e872a0SLloyd Pique  *
23*84e872a0SLloyd Pique  * Permission is hereby granted, free of charge, to any person
24*84e872a0SLloyd Pique  * obtaining a copy of this software and associated documentation files
25*84e872a0SLloyd Pique  * (the "Software"), to deal in the Software without restriction,
26*84e872a0SLloyd Pique  * including without limitation the rights to use, copy, modify, merge,
27*84e872a0SLloyd Pique  * publish, distribute, sublicense, and/or sell copies of the Software,
28*84e872a0SLloyd Pique  * and to permit persons to whom the Software is furnished to do so,
29*84e872a0SLloyd Pique  * subject to the following conditions:
30*84e872a0SLloyd Pique  *
31*84e872a0SLloyd Pique  * The above copyright notice and this permission notice (including the
32*84e872a0SLloyd Pique  * next paragraph) shall be included in all copies or substantial
33*84e872a0SLloyd Pique  * portions of the Software.
34*84e872a0SLloyd Pique  *
35*84e872a0SLloyd Pique  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36*84e872a0SLloyd Pique  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37*84e872a0SLloyd Pique  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38*84e872a0SLloyd Pique  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
39*84e872a0SLloyd Pique  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
40*84e872a0SLloyd Pique  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41*84e872a0SLloyd Pique  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42*84e872a0SLloyd Pique  * SOFTWARE.
43*84e872a0SLloyd Pique  * </pre>
44*84e872a0SLloyd Pique  */
45*84e872a0SLloyd Pique struct another_intf;
46*84e872a0SLloyd Pique struct intf_A;
47*84e872a0SLloyd Pique struct intf_not_here;
48*84e872a0SLloyd Pique 
49*84e872a0SLloyd Pique #ifndef INTF_A_INTERFACE
50*84e872a0SLloyd Pique #define INTF_A_INTERFACE
51*84e872a0SLloyd Pique /**
52*84e872a0SLloyd Pique  * @page page_iface_intf_A intf_A
53*84e872a0SLloyd Pique  * @section page_iface_intf_A_desc Description
54*84e872a0SLloyd Pique  *
55*84e872a0SLloyd Pique  * A useless example trying to tickle the scanner.
56*84e872a0SLloyd Pique  * @section page_iface_intf_A_api API
57*84e872a0SLloyd Pique  * See @ref iface_intf_A.
58*84e872a0SLloyd Pique  */
59*84e872a0SLloyd Pique /**
60*84e872a0SLloyd Pique  * @defgroup iface_intf_A The intf_A interface
61*84e872a0SLloyd Pique  *
62*84e872a0SLloyd Pique  * A useless example trying to tickle the scanner.
63*84e872a0SLloyd Pique  */
64*84e872a0SLloyd Pique extern const struct wl_interface intf_A_interface;
65*84e872a0SLloyd Pique #endif
66*84e872a0SLloyd Pique 
67*84e872a0SLloyd Pique #ifndef INTF_A_FOO_ENUM
68*84e872a0SLloyd Pique #define INTF_A_FOO_ENUM
69*84e872a0SLloyd Pique enum intf_A_foo {
70*84e872a0SLloyd Pique 	/**
71*84e872a0SLloyd Pique 	 * this is the first
72*84e872a0SLloyd Pique 	 */
73*84e872a0SLloyd Pique 	INTF_A_FOO_FIRST = 0,
74*84e872a0SLloyd Pique 	/**
75*84e872a0SLloyd Pique 	 * this is the second
76*84e872a0SLloyd Pique 	 */
77*84e872a0SLloyd Pique 	INTF_A_FOO_SECOND = 1,
78*84e872a0SLloyd Pique 	/**
79*84e872a0SLloyd Pique 	 * this is the third
80*84e872a0SLloyd Pique 	 * @since 2
81*84e872a0SLloyd Pique 	 */
82*84e872a0SLloyd Pique 	INTF_A_FOO_THIRD = 2,
83*84e872a0SLloyd Pique };
84*84e872a0SLloyd Pique /**
85*84e872a0SLloyd Pique  * @ingroup iface_intf_A
86*84e872a0SLloyd Pique  */
87*84e872a0SLloyd Pique #define INTF_A_FOO_THIRD_SINCE_VERSION 2
88*84e872a0SLloyd Pique #endif /* INTF_A_FOO_ENUM */
89*84e872a0SLloyd Pique 
90*84e872a0SLloyd Pique /**
91*84e872a0SLloyd Pique  * @ingroup iface_intf_A
92*84e872a0SLloyd Pique  * @struct intf_A_listener
93*84e872a0SLloyd Pique  */
94*84e872a0SLloyd Pique struct intf_A_listener {
95*84e872a0SLloyd Pique 	/**
96*84e872a0SLloyd Pique 	 */
97*84e872a0SLloyd Pique 	void (*hey)(void *data,
98*84e872a0SLloyd Pique 		    struct intf_A *intf_A);
99*84e872a0SLloyd Pique };
100*84e872a0SLloyd Pique 
101*84e872a0SLloyd Pique /**
102*84e872a0SLloyd Pique  * @ingroup iface_intf_A
103*84e872a0SLloyd Pique  */
104*84e872a0SLloyd Pique static inline int
intf_A_add_listener(struct intf_A * intf_A,const struct intf_A_listener * listener,void * data)105*84e872a0SLloyd Pique intf_A_add_listener(struct intf_A *intf_A,
106*84e872a0SLloyd Pique 		    const struct intf_A_listener *listener, void *data)
107*84e872a0SLloyd Pique {
108*84e872a0SLloyd Pique 	return wl_proxy_add_listener((struct wl_proxy *) intf_A,
109*84e872a0SLloyd Pique 				     (void (**)(void)) listener, data);
110*84e872a0SLloyd Pique }
111*84e872a0SLloyd Pique 
112*84e872a0SLloyd Pique #define INTF_A_RQ1 0
113*84e872a0SLloyd Pique #define INTF_A_RQ2 1
114*84e872a0SLloyd Pique #define INTF_A_DESTROY 2
115*84e872a0SLloyd Pique 
116*84e872a0SLloyd Pique /**
117*84e872a0SLloyd Pique  * @ingroup iface_intf_A
118*84e872a0SLloyd Pique  */
119*84e872a0SLloyd Pique #define INTF_A_HEY_SINCE_VERSION 1
120*84e872a0SLloyd Pique 
121*84e872a0SLloyd Pique /**
122*84e872a0SLloyd Pique  * @ingroup iface_intf_A
123*84e872a0SLloyd Pique  */
124*84e872a0SLloyd Pique #define INTF_A_RQ1_SINCE_VERSION 1
125*84e872a0SLloyd Pique /**
126*84e872a0SLloyd Pique  * @ingroup iface_intf_A
127*84e872a0SLloyd Pique  */
128*84e872a0SLloyd Pique #define INTF_A_RQ2_SINCE_VERSION 1
129*84e872a0SLloyd Pique /**
130*84e872a0SLloyd Pique  * @ingroup iface_intf_A
131*84e872a0SLloyd Pique  */
132*84e872a0SLloyd Pique #define INTF_A_DESTROY_SINCE_VERSION 1
133*84e872a0SLloyd Pique 
134*84e872a0SLloyd Pique /** @ingroup iface_intf_A */
135*84e872a0SLloyd Pique static inline void
intf_A_set_user_data(struct intf_A * intf_A,void * user_data)136*84e872a0SLloyd Pique intf_A_set_user_data(struct intf_A *intf_A, void *user_data)
137*84e872a0SLloyd Pique {
138*84e872a0SLloyd Pique 	wl_proxy_set_user_data((struct wl_proxy *) intf_A, user_data);
139*84e872a0SLloyd Pique }
140*84e872a0SLloyd Pique 
141*84e872a0SLloyd Pique /** @ingroup iface_intf_A */
142*84e872a0SLloyd Pique static inline void *
intf_A_get_user_data(struct intf_A * intf_A)143*84e872a0SLloyd Pique intf_A_get_user_data(struct intf_A *intf_A)
144*84e872a0SLloyd Pique {
145*84e872a0SLloyd Pique 	return wl_proxy_get_user_data((struct wl_proxy *) intf_A);
146*84e872a0SLloyd Pique }
147*84e872a0SLloyd Pique 
148*84e872a0SLloyd Pique static inline uint32_t
intf_A_get_version(struct intf_A * intf_A)149*84e872a0SLloyd Pique intf_A_get_version(struct intf_A *intf_A)
150*84e872a0SLloyd Pique {
151*84e872a0SLloyd Pique 	return wl_proxy_get_version((struct wl_proxy *) intf_A);
152*84e872a0SLloyd Pique }
153*84e872a0SLloyd Pique 
154*84e872a0SLloyd Pique /**
155*84e872a0SLloyd Pique  * @ingroup iface_intf_A
156*84e872a0SLloyd Pique  */
157*84e872a0SLloyd Pique static inline void *
intf_A_rq1(struct intf_A * intf_A,const struct wl_interface * interface,uint32_t version)158*84e872a0SLloyd Pique intf_A_rq1(struct intf_A *intf_A, const struct wl_interface *interface, uint32_t version)
159*84e872a0SLloyd Pique {
160*84e872a0SLloyd Pique 	struct wl_proxy *untyped_new;
161*84e872a0SLloyd Pique 
162*84e872a0SLloyd Pique 	untyped_new = wl_proxy_marshal_flags((struct wl_proxy *) intf_A,
163*84e872a0SLloyd Pique 			 INTF_A_RQ1, interface, version, 0, interface->name, version, NULL);
164*84e872a0SLloyd Pique 
165*84e872a0SLloyd Pique 	return (void *) untyped_new;
166*84e872a0SLloyd Pique }
167*84e872a0SLloyd Pique 
168*84e872a0SLloyd Pique /**
169*84e872a0SLloyd Pique  * @ingroup iface_intf_A
170*84e872a0SLloyd Pique  */
171*84e872a0SLloyd Pique static inline struct intf_not_here *
intf_A_rq2(struct intf_A * intf_A,const char * str,int32_t i,uint32_t u,wl_fixed_t f,int32_t fd,struct another_intf * obj)172*84e872a0SLloyd Pique intf_A_rq2(struct intf_A *intf_A, const char *str, int32_t i, uint32_t u, wl_fixed_t f, int32_t fd, struct another_intf *obj)
173*84e872a0SLloyd Pique {
174*84e872a0SLloyd Pique 	struct wl_proxy *typed_new;
175*84e872a0SLloyd Pique 
176*84e872a0SLloyd Pique 	typed_new = wl_proxy_marshal_flags((struct wl_proxy *) intf_A,
177*84e872a0SLloyd Pique 			 INTF_A_RQ2, &intf_not_here_interface, wl_proxy_get_version((struct wl_proxy *) intf_A), 0, NULL, str, i, u, f, fd, obj);
178*84e872a0SLloyd Pique 
179*84e872a0SLloyd Pique 	return (struct intf_not_here *) typed_new;
180*84e872a0SLloyd Pique }
181*84e872a0SLloyd Pique 
182*84e872a0SLloyd Pique /**
183*84e872a0SLloyd Pique  * @ingroup iface_intf_A
184*84e872a0SLloyd Pique  */
185*84e872a0SLloyd Pique static inline void
intf_A_destroy(struct intf_A * intf_A)186*84e872a0SLloyd Pique intf_A_destroy(struct intf_A *intf_A)
187*84e872a0SLloyd Pique {
188*84e872a0SLloyd Pique 	wl_proxy_marshal_flags((struct wl_proxy *) intf_A,
189*84e872a0SLloyd Pique 			 INTF_A_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) intf_A), WL_MARSHAL_FLAG_DESTROY);
190*84e872a0SLloyd Pique }
191*84e872a0SLloyd Pique 
192*84e872a0SLloyd Pique #ifdef  __cplusplus
193*84e872a0SLloyd Pique }
194*84e872a0SLloyd Pique #endif
195*84e872a0SLloyd Pique 
196*84e872a0SLloyd Pique #endif
197