blob: c95fc5785307dd3bd047b18e9823abfc710fa06c [file] [log] [blame]
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -04001#ifndef WAYLAND_H
2#define WAYLAND_H
3
4#include <stdint.h>
5
6enum {
7 WL_EVENT_READABLE = 0x01,
8 WL_EVENT_WRITEABLE = 0x02
9};
10
11struct wl_event_loop;
12struct wl_event_source;
13typedef void (*wl_event_loop_func_t)(int fd, uint32_t mask, void *data);
14
15struct wl_event_loop *wl_event_loop_create(void);
16void wl_event_loop_destroy(struct wl_event_loop *loop);
17struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *loop,
18 int fd, uint32_t mask,
19 wl_event_loop_func_t func,
20 void *data);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040021int wl_event_loop_update_source(struct wl_event_loop *loop,
22 struct wl_event_source *source,
23 uint32_t mask);
24
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040025int wl_event_loop_remove_source(struct wl_event_loop *loop,
26 struct wl_event_source *source);
27int wl_event_loop_wait(struct wl_event_loop *loop);
28
29struct wl_hash {
30 struct wl_object **objects;
31 uint32_t count, alloc, id;
32};
33
34int wl_hash_insert(struct wl_hash *hash, struct wl_object *object);
35struct wl_object *wl_hash_lookup(struct wl_hash *hash, uint32_t id);
36void wl_hash_delete(struct wl_hash *hash, struct wl_object *object);
37
38struct wl_client;
39
40enum {
41 WL_ARGUMENT_UINT32,
42 WL_ARGUMENT_STRING,
43 WL_ARGUMENT_OBJECT,
44 WL_ARGUMENT_NEW_ID
45};
46
47struct wl_argument {
48 uint32_t type;
49 void *data;
50};
51
52struct wl_method {
53 const char *name;
54 void *func;
55 int argument_count;
56 const struct wl_argument *arguments;
57};
58
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040059struct wl_event {
60 const char *name;
61};
62
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040063struct wl_interface {
64 const char *name;
65 int version;
66 int method_count;
67 const struct wl_method *methods;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040068 int event_count;
69 const struct wl_event *events;
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040070};
71
72struct wl_object {
73 const struct wl_interface *interface;
74 uint32_t id;
75};
76
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040077struct wl_surface;
78struct wl_display;
79
80struct wl_compositor {
81 struct wl_compositor_interface *interface;
82};
83
84struct wl_compositor_interface {
85 void (*notify_surface_create)(struct wl_compositor *compositor,
86 struct wl_surface *surface);
87
88 void (*notify_surface_attach)(struct wl_compositor *compositor,
89 struct wl_surface *surface, uint32_t name,
90 uint32_t width, uint32_t height, uint32_t stride);
91};
92
93struct wl_compositor *wl_compositor_create(void);
94
95void wl_display_set_compositor(struct wl_display *display,
96 struct wl_compositor *compositor);
97
98
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040099#endif