Waltham  0.1.0
waltham-client.h
1 /*
2  * Copyright © 2013-2014 Collabora, Ltd.
3  * Copyright © 2016 DENSO CORPORATION
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #include <stdint.h>
26 
27 #include <waltham-object.h>
28 #include <waltham-util.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct wth_display;
35 struct wthp_blob_factory;
36 struct wthp_buffer;
37 struct wthp_callback;
38 struct wthp_compositor;
39 struct wthp_farstream;
40 struct wthp_farstream_remote;
41 struct wthp_keyboard;
42 struct wthp_output;
43 struct wthp_pointer;
44 struct wthp_region;
45 struct wthp_registry;
46 struct wthp_resource;
47 struct wthp_seat;
48 struct wthp_surface;
49 struct wthp_touch;
50 
51 #ifndef WALTHAM_CLIENT_H
52 #define WALTHAM_CLIENT_H
53 
55  void (*error) (struct wth_display * wth_display, struct wth_object * object_id, uint32_t code, const char * message);
56  void (*delete_id) (struct wth_display * wth_display, uint32_t id);
57  void (*server_version) (struct wth_display * wth_display, uint32_t server_version);
58 };
59 
60 static inline void
61 wth_display_set_listener(struct wth_display *self, const struct wth_display_listener *funcs, void *user_data)
62 {
63  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
64 }
65 
67  void (*global) (struct wthp_registry * wthp_registry, uint32_t name, const char * interface, uint32_t version);
68  void (*global_remove) (struct wthp_registry * wthp_registry, uint32_t name);
69 };
70 
71 static inline void
72 wthp_registry_set_listener(struct wthp_registry *self, const struct wthp_registry_listener *funcs, void *user_data)
73 {
74  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
75 }
76 
78  void (*done) (struct wthp_callback * wthp_callback, uint32_t callback_data);
79 };
80 
81 static inline void
82 wthp_callback_set_listener(struct wthp_callback *self, const struct wthp_callback_listener *funcs, void *user_data)
83 {
84  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
85 }
86 
88  void (*format) (struct wthp_blob_factory * wthp_blob_factory, uint32_t format);
89 };
90 
91 static inline void
92 wthp_blob_factory_set_listener(struct wthp_blob_factory *self, const struct wthp_blob_factory_listener *funcs, void *user_data)
93 {
94  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
95 }
96 
98  void (*complete) (struct wthp_buffer * wthp_buffer, uint32_t serial);
99 };
100 
101 static inline void
102 wthp_buffer_set_listener(struct wthp_buffer *self, const struct wthp_buffer_listener *funcs, void *user_data)
103 {
104  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
105 }
106 
108  void (*enter) (struct wthp_surface * wthp_surface, struct wthp_output * output);
109  void (*leave) (struct wthp_surface * wthp_surface, struct wthp_output * output);
110 };
111 
112 static inline void
113 wthp_surface_set_listener(struct wthp_surface *self, const struct wthp_surface_listener *funcs, void *user_data)
114 {
115  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
116 }
117 
119  void (*capabilities) (struct wthp_seat * wthp_seat, uint32_t capabilities);
120  void (*name) (struct wthp_seat * wthp_seat, const char * name);
121 };
122 
123 static inline void
124 wthp_seat_set_listener(struct wthp_seat *self, const struct wthp_seat_listener *funcs, void *user_data)
125 {
126  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
127 }
128 
130  void (*enter) (struct wthp_pointer * wthp_pointer, uint32_t serial, struct wthp_surface * surface, wth_fixed_t surface_x, wth_fixed_t surface_y);
131  void (*leave) (struct wthp_pointer * wthp_pointer, uint32_t serial, struct wthp_surface * surface);
132  void (*motion) (struct wthp_pointer * wthp_pointer, uint32_t time, wth_fixed_t surface_x, wth_fixed_t surface_y);
133  void (*button) (struct wthp_pointer * wthp_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state);
134  void (*axis) (struct wthp_pointer * wthp_pointer, uint32_t time, uint32_t axis, wth_fixed_t value);
135  void (*frame) (struct wthp_pointer * wthp_pointer);
136  void (*axis_source) (struct wthp_pointer * wthp_pointer, uint32_t axis_source);
137  void (*axis_stop) (struct wthp_pointer * wthp_pointer, uint32_t time, uint32_t axis);
138  void (*axis_discrete) (struct wthp_pointer * wthp_pointer, uint32_t axis, int32_t discrete);
139 };
140 
141 static inline void
142 wthp_pointer_set_listener(struct wthp_pointer *self, const struct wthp_pointer_listener *funcs, void *user_data)
143 {
144  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
145 }
146 
148  void (*keymap) (struct wthp_keyboard * wthp_keyboard, uint32_t format, uint32_t keymap_sz, void * keymap);
149  void (*enter) (struct wthp_keyboard * wthp_keyboard, uint32_t serial, struct wthp_surface * surface, struct wth_array * keys);
150  void (*leave) (struct wthp_keyboard * wthp_keyboard, uint32_t serial, struct wthp_surface * surface);
151  void (*key) (struct wthp_keyboard * wthp_keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
152  void (*modifiers) (struct wthp_keyboard * wthp_keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
153  void (*repeat_info) (struct wthp_keyboard * wthp_keyboard, int32_t rate, int32_t delay);
154 };
155 
156 static inline void
157 wthp_keyboard_set_listener(struct wthp_keyboard *self, const struct wthp_keyboard_listener *funcs, void *user_data)
158 {
159  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
160 }
161 
163  void (*down) (struct wthp_touch * wthp_touch, uint32_t serial, uint32_t time, struct wthp_surface * surface, int32_t id, wth_fixed_t x, wth_fixed_t y);
164  void (*up) (struct wthp_touch * wthp_touch, uint32_t serial, uint32_t time, int32_t id);
165  void (*motion) (struct wthp_touch * wthp_touch, uint32_t time, int32_t id, wth_fixed_t x, wth_fixed_t y);
166  void (*frame) (struct wthp_touch * wthp_touch);
167  void (*cancel) (struct wthp_touch * wthp_touch);
168 };
169 
170 static inline void
171 wthp_touch_set_listener(struct wthp_touch *self, const struct wthp_touch_listener *funcs, void *user_data)
172 {
173  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
174 }
175 
177  void (*geometry) (struct wthp_output * wthp_output, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char * make, const char * model, int32_t transform);
178  void (*mode) (struct wthp_output * wthp_output, uint32_t flags, int32_t width, int32_t height, int32_t refresh);
179  void (*done) (struct wthp_output * wthp_output);
180  void (*scale) (struct wthp_output * wthp_output, int32_t factor);
181 };
182 
183 static inline void
184 wthp_output_set_listener(struct wthp_output *self, const struct wthp_output_listener *funcs, void *user_data)
185 {
186  wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
187 }
188 
190  void (*port) (struct wthp_farstream_remote * wthp_farstream_remote, uint32_t port);
191  void (*codec_answer) (struct wthp_farstream_remote * wthp_farstream_remote, const char * list);
192  void (*error) (struct wthp_farstream_remote * wthp_farstream_remote, uint32_t code, const char * message);
193 };
194 
195 static inline void
196 wth_display_free(struct wth_display *self)
197 {
198  wth_object_delete((struct wth_object *)self);
199 }
200 
201 void
202 wth_display_client_version (struct wth_display * wth_display, uint32_t client_version);
203 
204 struct wthp_callback *
205 wth_display_sync (struct wth_display * wth_display);
206 
207 struct wthp_registry *
208 wth_display_get_registry (struct wth_display * wth_display);
209 
210 static inline void
211 wthp_registry_free(struct wthp_registry *self)
212 {
213  wth_object_delete((struct wth_object *)self);
214 }
215 
216 void
217 wthp_registry_destroy (struct wthp_registry * wthp_registry);
218 
219 struct wth_object *
220 wthp_registry_bind (struct wthp_registry * wthp_registry, uint32_t name, const char * interface, uint32_t version);
221 
222 static inline void
223 wthp_callback_free(struct wthp_callback *self)
224 {
225  wth_object_delete((struct wth_object *)self);
226 }
227 
228 static inline void
229 wthp_compositor_free(struct wthp_compositor *self)
230 {
231  wth_object_delete((struct wth_object *)self);
232 }
233 
234 struct wthp_surface *
235 wthp_compositor_create_surface (struct wthp_compositor * wthp_compositor);
236 
237 struct wthp_region *
238 wthp_compositor_create_region (struct wthp_compositor * wthp_compositor);
239 
240 static inline void
241 wthp_blob_factory_free(struct wthp_blob_factory *self)
242 {
243  wth_object_delete((struct wth_object *)self);
244 }
245 
246 struct wthp_buffer *
247 wthp_blob_factory_create_buffer (struct wthp_blob_factory * wthp_blob_factory, uint32_t data_sz, void * data, int32_t width, int32_t height, int32_t stride, uint32_t format);
248 
249 static inline void
250 wthp_buffer_free(struct wthp_buffer *self)
251 {
252  wth_object_delete((struct wth_object *)self);
253 }
254 
255 void
256 wthp_buffer_destroy (struct wthp_buffer * wthp_buffer);
257 
258 static inline void
259 wthp_surface_free(struct wthp_surface *self)
260 {
261  wth_object_delete((struct wth_object *)self);
262 }
263 
264 void
265 wthp_surface_destroy (struct wthp_surface * wthp_surface);
266 
267 void
268 wthp_surface_attach (struct wthp_surface * wthp_surface, struct wthp_buffer * buffer, int32_t x, int32_t y);
269 
270 void
271 wthp_surface_damage (struct wthp_surface * wthp_surface, int32_t x, int32_t y, int32_t width, int32_t height);
272 
273 struct wthp_callback *
274 wthp_surface_frame (struct wthp_surface * wthp_surface);
275 
276 void
277 wthp_surface_set_opaque_region (struct wthp_surface * wthp_surface, struct wthp_region * region);
278 
279 void
280 wthp_surface_set_input_region (struct wthp_surface * wthp_surface, struct wthp_region * region);
281 
282 void
283 wthp_surface_commit (struct wthp_surface * wthp_surface);
284 
285 void
286 wthp_surface_set_buffer_transform (struct wthp_surface * wthp_surface, int32_t transform);
287 
288 void
289 wthp_surface_set_buffer_scale (struct wthp_surface * wthp_surface, int32_t scale);
290 
291 void
292 wthp_surface_damage_buffer (struct wthp_surface * wthp_surface, int32_t x, int32_t y, int32_t width, int32_t height);
293 
294 static inline void
295 wthp_seat_free(struct wthp_seat *self)
296 {
297  wth_object_delete((struct wth_object *)self);
298 }
299 
300 struct wthp_pointer *
301 wthp_seat_get_pointer (struct wthp_seat * wthp_seat);
302 
303 struct wthp_keyboard *
304 wthp_seat_get_keyboard (struct wthp_seat * wthp_seat);
305 
306 struct wthp_touch *
307 wthp_seat_get_touch (struct wthp_seat * wthp_seat);
308 
309 void
310 wthp_seat_release (struct wthp_seat * wthp_seat);
311 
312 static inline void
313 wthp_pointer_free(struct wthp_pointer *self)
314 {
315  wth_object_delete((struct wth_object *)self);
316 }
317 
318 void
319 wthp_pointer_set_cursor (struct wthp_pointer * wthp_pointer, uint32_t serial, struct wthp_surface * surface, int32_t hotspot_x, int32_t hotspot_y);
320 
321 void
322 wthp_pointer_release (struct wthp_pointer * wthp_pointer);
323 
324 static inline void
325 wthp_keyboard_free(struct wthp_keyboard *self)
326 {
327  wth_object_delete((struct wth_object *)self);
328 }
329 
330 void
331 wthp_keyboard_release (struct wthp_keyboard * wthp_keyboard);
332 
333 static inline void
334 wthp_touch_free(struct wthp_touch *self)
335 {
336  wth_object_delete((struct wth_object *)self);
337 }
338 
339 void
340 wthp_touch_release (struct wthp_touch * wthp_touch);
341 
342 static inline void
343 wthp_output_free(struct wthp_output *self)
344 {
345  wth_object_delete((struct wth_object *)self);
346 }
347 
348 static inline void
349 wthp_region_free(struct wthp_region *self)
350 {
351  wth_object_delete((struct wth_object *)self);
352 }
353 
354 void
355 wthp_region_destroy (struct wthp_region * wthp_region);
356 
357 void
358 wthp_region_add (struct wthp_region * wthp_region, int32_t x, int32_t y, int32_t width, int32_t height);
359 
360 void
361 wthp_region_subtract (struct wthp_region * wthp_region, int32_t x, int32_t y, int32_t width, int32_t height);
362 
363 static inline void
364 wthp_farstream_free(struct wthp_farstream *self)
365 {
366  wth_object_delete((struct wth_object *)self);
367 }
368 
369 void
370 wthp_farstream_destroy (struct wthp_farstream * wthp_farstream);
371 
372 struct wthp_farstream_remote *
373 wthp_farstream_connect (struct wthp_farstream * wthp_farstream, uint32_t port);
374 
375 static inline void
376 wthp_farstream_remote_free(struct wthp_farstream_remote *self)
377 {
378  wth_object_delete((struct wth_object *)self);
379 }
380 
381 void
382 wthp_farstream_remote_destroy (struct wthp_farstream_remote * wthp_farstream_remote);
383 
384 void
385 wthp_farstream_remote_codec_offer (struct wthp_farstream_remote * wthp_farstream_remote, const char * list);
386 
387 struct wthp_buffer *
388 wthp_farstream_remote_create_buffer (struct wthp_farstream_remote * wthp_farstream_remote, uint32_t frame_id);
389 
390 #ifdef __cplusplus
391 }
392 #endif
393 
394 #endif
Definition: waltham-client.h:107
Definition: waltham-client.h:129
Definition: waltham-client.h:77
Definition: waltham-client.h:189
Definition: waltham-client.h:118
Definition: waltham-client.h:176
Definition: waltham-client.h:87
Definition: waltham-client.h:66
void wth_object_delete(struct wth_object *object)
Destroy a protocol object.
A generic Waltham protocol object representation (a proxy)
Definition: waltham-util.h:64
Definition: waltham-client.h:97
Definition: waltham-client.h:54
Waltham generic protocol object interface.
Utility classes, functions, and macros.
Definition: waltham-client.h:147
Definition: waltham-client.h:162