Change scanner.c license to MIT
[profile/ivi/wayland.git] / src / wayland-client.h
1 /*
2  * Copyright © 2008 Kristian Høgsberg
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that copyright
7  * notice and this permission notice appear in supporting documentation, and
8  * that the name of the copyright holders not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission.  The copyright holders make no representations
11  * about the suitability of this software for any purpose.  It is provided "as
12  * is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20  * OF THIS SOFTWARE.
21  */
22
23 #ifndef _WAYLAND_CLIENT_H
24 #define _WAYLAND_CLIENT_H
25
26 #include "wayland-util.h"
27
28 #ifdef  __cplusplus
29 extern "C" {
30 #endif
31
32 struct wl_proxy;
33 struct wl_display;
34
35 void wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
36 struct wl_proxy *wl_proxy_create(struct wl_proxy *factory,
37                                  const struct wl_interface *interface);
38 struct wl_proxy *wl_proxy_create_for_id(struct wl_display *display,
39                                         const struct wl_interface *interface,
40                                         uint32_t id);
41 void wl_proxy_destroy(struct wl_proxy *proxy);
42 int wl_proxy_add_listener(struct wl_proxy *proxy,
43                           void (**implementation)(void), void *data);
44 void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
45 void *wl_proxy_get_user_data(struct wl_proxy *proxy);
46
47 #include "wayland-client-protocol.h"
48
49 #define WL_DISPLAY_READABLE 0x01
50 #define WL_DISPLAY_WRITABLE 0x02
51
52 typedef int (*wl_display_update_func_t)(uint32_t mask, void *data);
53 typedef void (*wl_display_sync_func_t)(void *data);
54 typedef void (*wl_display_frame_func_t)(struct wl_surface *surface,
55                                         void *data, uint32_t time);
56
57 struct wl_display *wl_display_connect(const char *name);
58 void wl_display_destroy(struct wl_display *display);
59 int wl_display_get_fd(struct wl_display *display,
60                       wl_display_update_func_t update, void *data);
61 uint32_t wl_display_allocate_id(struct wl_display *display);
62 void wl_display_iterate(struct wl_display *display, uint32_t mask);
63 void wl_display_flush(struct wl_display *display);
64 int wl_display_sync_callback(struct wl_display *display,
65                              wl_display_sync_func_t func, void *data);
66 int wl_display_frame_callback(struct wl_display *display,
67                               struct wl_surface *surface,
68                               wl_display_frame_func_t func, void *data);
69
70 struct wl_global_listener;
71 typedef void (*wl_display_global_func_t)(struct wl_display *display,
72                                          uint32_t id,
73                                          const char *interface,
74                                          uint32_t version,
75                                          void *data);
76 void
77 wl_display_remove_global_listener(struct wl_display *display,
78                                   struct wl_global_listener *listener);
79 struct wl_global_listener *
80 wl_display_add_global_listener(struct wl_display *display,
81                                wl_display_global_func_t handler, void *data);
82 WL_EXPORT uint32_t
83 wl_display_get_global(struct wl_display *display,
84                       const char *interface, uint32_t version);
85
86 #ifdef  __cplusplus
87 }
88 #endif
89
90 #endif