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> |
Kristian Høgsberg | 1e4b86a | 2008-11-23 23:41:08 -0500 | [diff] [blame^] | 5 | #include "wayland-util.h" |
Kristian Høgsberg | b7a0192 | 2008-11-08 15:39:41 -0500 | [diff] [blame] | 6 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 7 | enum { |
| 8 | WL_EVENT_READABLE = 0x01, |
| 9 | WL_EVENT_WRITEABLE = 0x02 |
| 10 | }; |
| 11 | |
| 12 | struct wl_event_loop; |
| 13 | struct wl_event_source; |
Kristian Høgsberg | 5ebb317 | 2008-10-11 19:21:35 -0400 | [diff] [blame] | 14 | typedef void (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data); |
| 15 | typedef void (*wl_event_loop_idle_func_t)(void *data); |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 16 | |
| 17 | struct wl_event_loop *wl_event_loop_create(void); |
| 18 | void wl_event_loop_destroy(struct wl_event_loop *loop); |
| 19 | struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *loop, |
| 20 | int fd, uint32_t mask, |
Kristian Høgsberg | 5ebb317 | 2008-10-11 19:21:35 -0400 | [diff] [blame] | 21 | wl_event_loop_fd_func_t func, |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 22 | void *data); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 23 | int wl_event_loop_update_source(struct wl_event_loop *loop, |
| 24 | struct wl_event_source *source, |
| 25 | uint32_t mask); |
| 26 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 27 | int wl_event_loop_remove_source(struct wl_event_loop *loop, |
| 28 | struct wl_event_source *source); |
| 29 | int wl_event_loop_wait(struct wl_event_loop *loop); |
Kristian Høgsberg | 5ebb317 | 2008-10-11 19:21:35 -0400 | [diff] [blame] | 30 | struct wl_event_source *wl_event_loop_add_idle(struct wl_event_loop *loop, |
| 31 | wl_event_loop_idle_func_t func, |
| 32 | void *data); |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 33 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 34 | struct wl_client; |
| 35 | |
| 36 | enum { |
| 37 | WL_ARGUMENT_UINT32, |
| 38 | WL_ARGUMENT_STRING, |
| 39 | WL_ARGUMENT_OBJECT, |
| 40 | WL_ARGUMENT_NEW_ID |
| 41 | }; |
| 42 | |
| 43 | struct wl_argument { |
| 44 | uint32_t type; |
| 45 | void *data; |
| 46 | }; |
| 47 | |
| 48 | struct wl_method { |
| 49 | const char *name; |
| 50 | void *func; |
| 51 | int argument_count; |
| 52 | const struct wl_argument *arguments; |
| 53 | }; |
| 54 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 55 | struct wl_event { |
| 56 | const char *name; |
| 57 | }; |
| 58 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 59 | struct wl_interface { |
| 60 | const char *name; |
| 61 | int version; |
| 62 | int method_count; |
| 63 | const struct wl_method *methods; |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 64 | int event_count; |
| 65 | const struct wl_event *events; |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | struct wl_object { |
| 69 | const struct wl_interface *interface; |
| 70 | uint32_t id; |
| 71 | }; |
| 72 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 73 | struct wl_surface; |
| 74 | struct wl_display; |
| 75 | |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 76 | struct wl_map { |
| 77 | int32_t x, y, width, height; |
| 78 | }; |
| 79 | |
Kristian Høgsberg | 5ebb317 | 2008-10-11 19:21:35 -0400 | [diff] [blame] | 80 | struct wl_event_loop *wl_display_get_event_loop(struct wl_display *display); |
| 81 | |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 82 | void wl_surface_set_data(struct wl_surface *surface, void *data); |
| 83 | void *wl_surface_get_data(struct wl_surface *surface); |
| 84 | |
Kristian Høgsberg | f921289 | 2008-10-11 18:40:23 -0400 | [diff] [blame] | 85 | struct wl_surface_iterator; |
| 86 | struct wl_surface_iterator * |
| 87 | wl_surface_iterator_create(struct wl_display *display, uint32_t mask); |
| 88 | int wl_surface_iterator_next(struct wl_surface_iterator *iterator, |
| 89 | struct wl_surface **surface); |
| 90 | void wl_surface_iterator_destroy(struct wl_surface_iterator *iterator); |
| 91 | |
Kristian Høgsberg | f9bc795 | 2008-11-02 10:12:29 -0500 | [diff] [blame] | 92 | struct wl_object * |
| 93 | wl_input_device_create(struct wl_display *display, |
| 94 | const char *path, uint32_t id); |
Kristian Høgsberg | 1e4b86a | 2008-11-23 23:41:08 -0500 | [diff] [blame^] | 95 | void |
| 96 | wl_display_add_object(struct wl_display *display, struct wl_object *object); |
Kristian Høgsberg | 14fcff7 | 2008-11-23 19:10:23 -0500 | [diff] [blame] | 97 | int |
| 98 | wl_display_add_global(struct wl_display *display, struct wl_object *object); |
Kristian Høgsberg | 1e4b86a | 2008-11-23 23:41:08 -0500 | [diff] [blame^] | 99 | |
Kristian Høgsberg | f9bc795 | 2008-11-02 10:12:29 -0500 | [diff] [blame] | 100 | void |
| 101 | wl_display_post_relative_event(struct wl_display *display, |
| 102 | struct wl_object *source, int dx, int dy); |
| 103 | void |
| 104 | wl_display_post_absolute_event(struct wl_display *display, |
| 105 | struct wl_object *source, int x, int y); |
| 106 | void |
| 107 | wl_display_post_button_event(struct wl_display *display, |
| 108 | struct wl_object *source, int button, int state); |
| 109 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 110 | struct wl_compositor { |
Kristian Høgsberg | 5503bf8 | 2008-11-06 10:38:17 -0500 | [diff] [blame] | 111 | const struct wl_compositor_interface *interface; |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 112 | }; |
| 113 | |
| 114 | struct wl_compositor_interface { |
| 115 | void (*notify_surface_create)(struct wl_compositor *compositor, |
| 116 | struct wl_surface *surface); |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 117 | void (*notify_surface_destroy)(struct wl_compositor *compositor, |
| 118 | struct wl_surface *surface); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 119 | void (*notify_surface_attach)(struct wl_compositor *compositor, |
Kristian Høgsberg | 7f77bd8 | 2008-11-07 08:39:37 -0500 | [diff] [blame] | 120 | struct wl_surface *surface, |
| 121 | uint32_t name, |
| 122 | uint32_t width, uint32_t height, |
| 123 | uint32_t stride); |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 124 | void (*notify_surface_map)(struct wl_compositor *compositor, |
Kristian Høgsberg | 7f77bd8 | 2008-11-07 08:39:37 -0500 | [diff] [blame] | 125 | struct wl_surface *surface, |
| 126 | struct wl_map *map); |
| 127 | void (*notify_surface_copy)(struct wl_compositor *compositor, |
| 128 | struct wl_surface *surface, |
| 129 | int32_t dst_x, int32_t dst_y, |
| 130 | uint32_t name, uint32_t stride, |
| 131 | int32_t x, int32_t y, |
| 132 | int32_t width, int32_t height); |
| 133 | void (*notify_surface_damage)(struct wl_compositor *compositor, |
| 134 | struct wl_surface *surface, |
| 135 | int32_t x, int32_t y, |
| 136 | int32_t width, int32_t height); |
Kristian Høgsberg | 4c9f2c9 | 2008-11-21 19:25:44 -0500 | [diff] [blame] | 137 | void (*notify_pointer_motion)(struct wl_compositor *compositor, |
| 138 | struct wl_object *source, |
| 139 | int32_t x, int32_t y); |
| 140 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 141 | }; |
| 142 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 143 | void wl_display_set_compositor(struct wl_display *display, |
| 144 | struct wl_compositor *compositor); |
| 145 | |
Kristian Høgsberg | b7a0192 | 2008-11-08 15:39:41 -0500 | [diff] [blame] | 146 | struct wl_compositor * |
| 147 | wl_compositor_create(struct wl_display *display); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 148 | |
Kristian Høgsberg | 97f1ebe | 2008-09-30 09:46:10 -0400 | [diff] [blame] | 149 | #endif |