2 * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
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
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
26 #ifndef TBM_TEST_CLIENT_PROTOCOL_H
27 #define TBM_TEST_CLIENT_PROTOCOL_H
35 #include "wayland-client.h"
44 struct wl_test_remote;
45 struct wl_test_surface;
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;
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
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
62 wl_tbm_test_set_user_data(struct wl_tbm_test *wl_tbm_test, void *user_data)
64 wl_proxy_set_user_data((struct wl_proxy *) wl_tbm_test, user_data);
68 wl_tbm_test_get_user_data(struct wl_tbm_test *wl_tbm_test)
70 return wl_proxy_get_user_data((struct wl_proxy *) wl_tbm_test);
73 static inline uint32_t
74 wl_tbm_test_get_version(struct wl_tbm_test *wl_tbm_test)
76 return wl_proxy_get_version((struct wl_proxy *) wl_tbm_test);
80 wl_tbm_test_destroy(struct wl_tbm_test *wl_tbm_test)
82 wl_proxy_destroy((struct wl_proxy *) wl_tbm_test);
85 static inline struct wl_test_surface *
86 wl_tbm_test_create_surface(struct wl_tbm_test *wl_tbm_test)
88 struct wl_proxy *surface;
90 surface = wl_proxy_marshal_constructor((struct wl_proxy *) wl_tbm_test,
91 WL_TBM_TEST_CREATE_SURFACE, &wl_test_surface_interface, NULL);
93 return (struct wl_test_surface *) surface;
97 wl_tbm_test_set_active_queue(struct wl_tbm_test *wl_tbm_test, struct wl_test_surface *surface)
99 wl_proxy_marshal((struct wl_proxy *) wl_tbm_test,
100 WL_TBM_TEST_SET_ACTIVE_QUEUE, surface);
104 wl_tbm_test_set_provider(struct wl_tbm_test *wl_tbm_test, struct wl_test_surface *surface, const char *name)
106 wl_proxy_marshal((struct wl_proxy *) wl_tbm_test,
107 WL_TBM_TEST_SET_PROVIDER, surface, name);
110 static inline struct wl_test_remote *
111 wl_tbm_test_create_remote_surface(struct wl_tbm_test *wl_tbm_test, const char *name)
113 struct wl_proxy *surface;
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);
118 return (struct wl_test_remote *) surface;
121 #define WL_TEST_SURFACE_DESTROY 0
122 #define WL_TEST_SURFACE_ATTACH 1
123 #define WL_TEST_SURFACE_FRAME 2
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
130 wl_test_surface_set_user_data(struct wl_test_surface *wl_test_surface, void *user_data)
132 wl_proxy_set_user_data((struct wl_proxy *) wl_test_surface, user_data);
136 wl_test_surface_get_user_data(struct wl_test_surface *wl_test_surface)
138 return wl_proxy_get_user_data((struct wl_proxy *) wl_test_surface);
141 static inline uint32_t
142 wl_test_surface_get_version(struct wl_test_surface *wl_test_surface)
144 return wl_proxy_get_version((struct wl_proxy *) wl_test_surface);
148 wl_test_surface_destroy(struct wl_test_surface *wl_test_surface)
150 wl_proxy_marshal((struct wl_proxy *) wl_test_surface,
151 WL_TEST_SURFACE_DESTROY);
153 wl_proxy_destroy((struct wl_proxy *) wl_test_surface);
157 wl_test_surface_attach(struct wl_test_surface *wl_test_surface, struct wl_buffer *buffer)
159 wl_proxy_marshal((struct wl_proxy *) wl_test_surface,
160 WL_TEST_SURFACE_ATTACH, buffer);
163 static inline struct wl_callback *
164 wl_test_surface_frame(struct wl_test_surface *wl_test_surface)
166 struct wl_proxy *callback;
168 callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_test_surface,
169 WL_TEST_SURFACE_FRAME, &wl_callback_interface, NULL);
171 return (struct wl_callback *) callback;
174 struct wl_test_remote_listener {
179 void (*update)(void *data,
180 struct wl_test_remote *wl_test_remote,
181 struct wl_buffer *buffer);
185 wl_test_remote_add_listener(struct wl_test_remote *wl_test_remote,
186 const struct wl_test_remote_listener *listener, void *data)
188 return wl_proxy_add_listener((struct wl_proxy *) wl_test_remote,
189 (void (**)(void)) listener, data);
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
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
205 wl_test_remote_set_user_data(struct wl_test_remote *wl_test_remote, void *user_data)
207 wl_proxy_set_user_data((struct wl_proxy *) wl_test_remote, user_data);
211 wl_test_remote_get_user_data(struct wl_test_remote *wl_test_remote)
213 return wl_proxy_get_user_data((struct wl_proxy *) wl_test_remote);
216 static inline uint32_t
217 wl_test_remote_get_version(struct wl_test_remote *wl_test_remote)
219 return wl_proxy_get_version((struct wl_proxy *) wl_test_remote);
223 wl_test_remote_destroy(struct wl_test_remote *wl_test_remote)
225 wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
226 WL_TEST_REMOTE_DESTROY);
228 wl_proxy_destroy((struct wl_proxy *) wl_test_remote);
232 wl_test_remote_release(struct wl_test_remote *wl_test_remote, struct wl_buffer *buffer)
234 wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
235 WL_TEST_REMOTE_RELEASE, buffer);
239 wl_test_remote_redirect(struct wl_test_remote *wl_test_remote, struct wl_tbm *wl_tbm)
241 wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
242 WL_TEST_REMOTE_REDIRECT, wl_tbm);
246 wl_test_remote_unredirect(struct wl_test_remote *wl_test_remote)
248 wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
249 WL_TEST_REMOTE_UNREDIRECT);
253 wl_test_remote_bind(struct wl_test_remote *wl_test_remote, struct wl_test_surface *surface)
255 wl_proxy_marshal((struct wl_proxy *) wl_test_remote,
256 WL_TEST_REMOTE_BIND, surface);