Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 1 | #ifndef WAYLAND_H |
| 2 | #define WAYLAND_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | enum { |
| 7 | WL_EVENT_READABLE = 0x01, |
| 8 | WL_EVENT_WRITEABLE = 0x02 |
| 9 | }; |
| 10 | |
| 11 | struct wl_event_loop; |
| 12 | struct wl_event_source; |
| 13 | typedef void (*wl_event_loop_func_t)(int fd, uint32_t mask, void *data); |
| 14 | |
| 15 | struct wl_event_loop *wl_event_loop_create(void); |
| 16 | void wl_event_loop_destroy(struct wl_event_loop *loop); |
| 17 | struct 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øgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 21 | int wl_event_loop_update_source(struct wl_event_loop *loop, |
| 22 | struct wl_event_source *source, |
| 23 | uint32_t mask); |
| 24 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 25 | int wl_event_loop_remove_source(struct wl_event_loop *loop, |
| 26 | struct wl_event_source *source); |
| 27 | int wl_event_loop_wait(struct wl_event_loop *loop); |
| 28 | |
| 29 | struct wl_hash { |
| 30 | struct wl_object **objects; |
| 31 | uint32_t count, alloc, id; |
| 32 | }; |
| 33 | |
| 34 | int wl_hash_insert(struct wl_hash *hash, struct wl_object *object); |
| 35 | struct wl_object *wl_hash_lookup(struct wl_hash *hash, uint32_t id); |
| 36 | void wl_hash_delete(struct wl_hash *hash, struct wl_object *object); |
| 37 | |
| 38 | struct wl_client; |
| 39 | |
| 40 | enum { |
| 41 | WL_ARGUMENT_UINT32, |
| 42 | WL_ARGUMENT_STRING, |
| 43 | WL_ARGUMENT_OBJECT, |
| 44 | WL_ARGUMENT_NEW_ID |
| 45 | }; |
| 46 | |
| 47 | struct wl_argument { |
| 48 | uint32_t type; |
| 49 | void *data; |
| 50 | }; |
| 51 | |
| 52 | struct wl_method { |
| 53 | const char *name; |
| 54 | void *func; |
| 55 | int argument_count; |
| 56 | const struct wl_argument *arguments; |
| 57 | }; |
| 58 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 59 | struct wl_event { |
| 60 | const char *name; |
| 61 | }; |
| 62 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 63 | struct wl_interface { |
| 64 | const char *name; |
| 65 | int version; |
| 66 | int method_count; |
| 67 | const struct wl_method *methods; |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 68 | int event_count; |
| 69 | const struct wl_event *events; |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | struct wl_object { |
| 73 | const struct wl_interface *interface; |
| 74 | uint32_t id; |
| 75 | }; |
| 76 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 77 | struct wl_surface; |
| 78 | struct wl_display; |
| 79 | |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 80 | struct wl_map { |
| 81 | int32_t x, y, width, height; |
| 82 | }; |
| 83 | |
| 84 | void wl_surface_set_data(struct wl_surface *surface, void *data); |
| 85 | void *wl_surface_get_data(struct wl_surface *surface); |
| 86 | |
Kristian Høgsberg | f921289 | 2008-10-11 18:40:23 -0400 | [diff] [blame^] | 87 | struct wl_surface_iterator; |
| 88 | struct wl_surface_iterator * |
| 89 | wl_surface_iterator_create(struct wl_display *display, uint32_t mask); |
| 90 | int wl_surface_iterator_next(struct wl_surface_iterator *iterator, |
| 91 | struct wl_surface **surface); |
| 92 | void wl_surface_iterator_destroy(struct wl_surface_iterator *iterator); |
| 93 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 94 | struct wl_compositor { |
| 95 | struct wl_compositor_interface *interface; |
| 96 | }; |
| 97 | |
| 98 | struct wl_compositor_interface { |
| 99 | void (*notify_surface_create)(struct wl_compositor *compositor, |
| 100 | struct wl_surface *surface); |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 101 | void (*notify_surface_destroy)(struct wl_compositor *compositor, |
| 102 | struct wl_surface *surface); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 103 | void (*notify_surface_attach)(struct wl_compositor *compositor, |
| 104 | struct wl_surface *surface, uint32_t name, |
| 105 | uint32_t width, uint32_t height, uint32_t stride); |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 106 | void (*notify_surface_map)(struct wl_compositor *compositor, |
| 107 | struct wl_surface *surface, struct wl_map *map); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 108 | }; |
| 109 | |
Kristian Høgsberg | f921289 | 2008-10-11 18:40:23 -0400 | [diff] [blame^] | 110 | struct wl_compositor *wl_compositor_create(struct wl_display *display); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 111 | |
| 112 | void wl_display_set_compositor(struct wl_display *display, |
| 113 | struct wl_compositor *compositor); |
| 114 | |
| 115 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 116 | #endif |