Package version up to 0.8.8
[platform/core/uifw/wayland-tbm.git] / test / wayland-tbm-test-client-protocol.h
1 /*
2  * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
3  *
4  * Permission to use, copy, modify, distribute, and sell this
5  * software and its documentation for any purpose is hereby granted
6  * without fee, provided that\n the above copyright notice appear in
7  * all copies and that both that copyright notice and this permission
8  * notice appear in supporting documentation, and that the name of
9  * the copyright holders not be used in advertising or publicity
10  * pertaining to distribution of the software without specific,
11  * written prior permission.  The copyright holders make no
12  * representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied
14  * warranty.
15  *
16  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
23  * THIS SOFTWARE.
24  */
25
26 #ifndef TBM_TEST_CLIENT_PROTOCOL_H
27 #define TBM_TEST_CLIENT_PROTOCOL_H
28
29 #ifdef  __cplusplus
30 extern "C" {
31 #endif
32
33 #include <stdint.h>
34 #include <stddef.h>
35 #include "wayland-client.h"
36
37 struct wl_client;
38 struct wl_resource;
39
40 struct wl_buffer;
41 struct wl_callback;
42 struct wl_tbm;
43 struct wl_tbm_test;
44 struct wl_test_remote;
45 struct wl_test_surface;
46
47 extern const struct wl_interface wl_tbm_test_interface;
48 extern const struct wl_interface wl_test_surface_interface;
49 extern const struct wl_interface wl_test_remote_interface;
50
51 #define WL_TBM_TEST_CREATE_SURFACE      0
52 #define WL_TBM_TEST_SET_ACTIVE_QUEUE    1
53 #define WL_TBM_TEST_SET_PROVIDER        2
54 #define WL_TBM_TEST_CREATE_REMOTE_SURFACE       3
55
56 #define WL_TBM_TEST_CREATE_SURFACE_SINCE_VERSION        1
57 #define WL_TBM_TEST_SET_ACTIVE_QUEUE_SINCE_VERSION      1
58 #define WL_TBM_TEST_SET_PROVIDER_SINCE_VERSION  1
59 #define WL_TBM_TEST_CREATE_REMOTE_SURFACE_SINCE_VERSION 1
60
61 static inline void
62 wl_tbm_test_set_user_data(struct wl_tbm_test *wl_tbm_test, void *user_data)
63 {
64         wl_proxy_set_user_data((struct wl_proxy *) wl_tbm_test, user_data);
65 }
66
67 static inline void *
68 wl_tbm_test_get_user_data(struct wl_tbm_test *wl_tbm_test)
69 {
70         return wl_proxy_get_user_data((struct wl_proxy *) wl_tbm_test);
71 }
72
73 static inline uint32_t
74 wl_tbm_test_get_version(struct wl_tbm_test *wl_tbm_test)
75 {
76         return wl_proxy_get_version((struct wl_proxy *) wl_tbm_test);
77 }
78
79 static inline void
80 wl_tbm_test_destroy(struct wl_tbm_test *wl_tbm_test)
81 {
82         wl_proxy_destroy((struct wl_proxy *) wl_tbm_test);
83 }
84
85 static inline struct wl_test_surface *
86 wl_tbm_test_create_surface(struct wl_tbm_test *wl_tbm_test)
87 {
88         struct wl_proxy *surface;
89
90         surface = wl_proxy_marshal_constructor((struct wl_proxy *) wl_tbm_test,
91                          WL_TBM_TEST_CREATE_SURFACE, &wl_test_surface_interface, NULL);
92
93         return (struct wl_test_surface *) surface;
94 }
95
96 static inline void
97 wl_tbm_test_set_active_queue(struct wl_tbm_test *wl_tbm_test, struct wl_test_surface *surface)
98 {
99         wl_proxy_marshal((struct wl_proxy *) wl_tbm_test,
100                          WL_TBM_TEST_SET_ACTIVE_QUEUE, surface);
101 }
102
103 static inline void
104 wl_tbm_test_set_provider(struct wl_tbm_test *wl_tbm_test, struct wl_test_surface *surface, const char *name)
105 {
106         wl_proxy_marshal((struct wl_proxy *) wl_tbm_test,
107                          WL_TBM_TEST_SET_PROVIDER, surface, name);
108 }
109
110 static inline struct wl_test_remote *
111 wl_tbm_test_create_remote_surface(struct wl_tbm_test *wl_tbm_test, const char *name)
112 {
113         struct wl_proxy *surface;
114
115         surface = wl_proxy_marshal_constructor((struct wl_proxy *) wl_tbm_test,
116                          WL_TBM_TEST_CREATE_REMOTE_SURFACE, &wl_test_remote_interface, NULL, name);
117
118         return (struct wl_test_remote *) surface;
119 }
120
121 #define WL_TEST_SURFACE_DESTROY 0
122 #define WL_TEST_SURFACE_ATTACH  1
123 #define WL_TEST_SURFACE_FRAME   2
124
125 #define WL_TEST_SURFACE_DESTROY_SINCE_VERSION   1
126 #define WL_TEST_SURFACE_ATTACH_SINCE_VERSION    1
127 #define WL_TEST_SURFACE_FRAME_SINCE_VERSION     1
128
129 static inline void
130 wl_test_surface_set_user_data(struct wl_test_surface *wl_test_surface, void *user_data)
131 {
132         wl_proxy_set_user_data((struct wl_proxy *) wl_test_surface, user_data);
133 }
134
135 static inline void *
136 wl_test_surface_get_user_data(struct wl_test_surface *wl_test_surface)
137 {
138         return wl_proxy_get_user_data((struct wl_proxy *) wl_test_surface);
139 }
140
141 static inline uint32_t
142 wl_test_surface_get_version(struct wl_test_surface *wl_test_surface)
143 {
144         return wl_proxy_get_version((struct wl_proxy *) wl_test_surface);
145 }
146
147 static inline void
148 wl_test_surface_destroy(struct wl_test_surface *wl_test_surface)
149 {
150         wl_proxy_marshal((struct wl_proxy *) wl_test_surface,
151                          WL_TEST_SURFACE_DESTROY);
152
153         wl_proxy_destroy((struct wl_proxy *) wl_test_surface);
154 }
155
156 static inline void
157 wl_test_surface_attach(struct wl_test_surface *wl_test_surface, struct wl_buffer *buffer)
158 {
159         wl_proxy_marshal((struct wl_proxy *) wl_test_surface,
160                          WL_TEST_SURFACE_ATTACH, buffer);
161 }
162
163 static inline struct wl_callback *
164 wl_test_surface_frame(struct wl_test_surface *wl_test_surface)
165 {
166         struct wl_proxy *callback;
167
168         callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_test_surface,
169                          WL_TEST_SURFACE_FRAME, &wl_callback_interface, NULL);
170
171         return (struct wl_callback *) callback;
172 }
173
174 struct wl_test_remote_listener {
175         /**
176          * update - (none)
177          * @buffer: (none)
178          */
179         void (*update)(void *data,
180                        struct wl_test_remote *wl_test_remote,
181                        struct wl_buffer *buffer);
182 };
183
184 static inline int
185 wl_test_remote_add_listener(struct wl_test_remote *wl_test_remote,
186                             const struct wl_test_remote_listener *listener, void *data)
187 {
188         return wl_proxy_add_listener((struct wl_proxy *) wl_test_remote,
189                                      (void (**)(void)) listener, data);
190 }
191
192 #define WL_TEST_REMOTE_DESTROY  0
193 #define WL_TEST_REMOTE_RELEASE  1
194 #define WL_TEST_REMOTE_REDIRECT 2
195 #define WL_TEST_REMOTE_UNREDIRECT       3
196 #define WL_TEST_REMOTE_BIND     4
197
198 #define WL_TEST_REMOTE_DESTROY_SINCE_VERSION    1
199 #define WL_TEST_REMOTE_RELEASE_SINCE_VERSION    1
200 #define WL_TEST_REMOTE_REDIRECT_SINCE_VERSION   1
201 #define WL_TEST_REMOTE_UNREDIRECT_SINCE_VERSION 1
202 #define WL_TEST_REMOTE_BIND_SINCE_VERSION       1
203
204 static inline void
205 wl_test_remote_set_user_data(struct wl_test_remote *wl_test_remote, void *user_data)
206 {
207         wl_proxy_set_user_data((struct wl_proxy *) wl_test_remote, user_data);
208 }
209
210 static inline void *
211 wl_test_remote_get_user_data(struct wl_test_remote *wl_test_remote)
212 {
213         return wl_proxy_get_user_data((struct wl_proxy *) wl_test_remote);
214 }
215
216 static inline uint32_t
217 wl_test_remote_get_version(struct wl_test_remote *wl_test_remote)
218 {
219         return wl_proxy_get_version((struct wl_proxy *) wl_test_remote);
220 }
221
222 static inline void
223 wl_test_remote_destroy(struct wl_test_remote *wl_test_remote)
224 {
225         wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
226                          WL_TEST_REMOTE_DESTROY);
227
228         wl_proxy_destroy((struct wl_proxy *) wl_test_remote);
229 }
230
231 static inline void
232 wl_test_remote_release(struct wl_test_remote *wl_test_remote, struct wl_buffer *buffer)
233 {
234         wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
235                          WL_TEST_REMOTE_RELEASE, buffer);
236 }
237
238 static inline void
239 wl_test_remote_redirect(struct wl_test_remote *wl_test_remote, struct wl_tbm *wl_tbm)
240 {
241         wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
242                          WL_TEST_REMOTE_REDIRECT, wl_tbm);
243 }
244
245 static inline void
246 wl_test_remote_unredirect(struct wl_test_remote *wl_test_remote)
247 {
248         wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
249                          WL_TEST_REMOTE_UNREDIRECT);
250 }
251
252 static inline void
253 wl_test_remote_bind(struct wl_test_remote *wl_test_remote, struct wl_test_surface *surface)
254 {
255         wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
256                          WL_TEST_REMOTE_BIND, surface);
257 }
258
259 #ifdef  __cplusplus
260 }
261 #endif
262
263 #endif