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