Kristian Høgsberg | ffd710e | 2008-12-02 15:15:01 -0500 | [diff] [blame] | 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 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 23 | #ifndef _WAYLAND_CLIENT_H |
| 24 | #define _WAYLAND_CLIENT_H |
| 25 | |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 26 | struct wl_object; |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 27 | struct wl_display; |
| 28 | struct wl_surface; |
Kristian Høgsberg | de31d5c | 2008-12-18 17:55:33 -0500 | [diff] [blame] | 29 | struct wl_visual; |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 30 | |
Kristian Høgsberg | fb59084 | 2008-11-07 14:27:23 -0500 | [diff] [blame] | 31 | #define WL_DISPLAY_READABLE 0x01 |
| 32 | #define WL_DISPLAY_WRITABLE 0x02 |
| 33 | |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 34 | int |
| 35 | wl_object_implements(struct wl_object *object, |
| 36 | const char *interface, int version); |
| 37 | |
Kristian Høgsberg | fb59084 | 2008-11-07 14:27:23 -0500 | [diff] [blame] | 38 | typedef int (*wl_display_update_func_t)(uint32_t mask, void *data); |
| 39 | |
Kristian Høgsberg | dc0f355 | 2008-12-07 15:22:22 -0500 | [diff] [blame] | 40 | struct wl_display *wl_display_create(const char *name, size_t name_size); |
Kristian Høgsberg | 427524a | 2008-10-08 13:32:07 -0400 | [diff] [blame] | 41 | void wl_display_destroy(struct wl_display *display); |
Kristian Høgsberg | fb59084 | 2008-11-07 14:27:23 -0500 | [diff] [blame] | 42 | int wl_display_get_fd(struct wl_display *display, |
| 43 | wl_display_update_func_t update, void *data); |
| 44 | |
Kristian Høgsberg | 427524a | 2008-10-08 13:32:07 -0400 | [diff] [blame] | 45 | void wl_display_iterate(struct wl_display *display, uint32_t mask); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 46 | |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 47 | struct wl_global_listener; |
| 48 | typedef void (*wl_display_global_func_t)(struct wl_display *display, |
| 49 | struct wl_object *object, |
| 50 | void *data); |
Kristian Høgsberg | ee02ca6 | 2008-12-21 23:37:12 -0500 | [diff] [blame] | 51 | void |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 52 | wl_display_remove_global_listener(struct wl_display *display, |
| 53 | struct wl_global_listener *listener); |
| 54 | |
| 55 | struct wl_global_listener * |
| 56 | wl_display_add_global_listener(struct wl_display *display, |
| 57 | wl_display_global_func_t handler, void *data); |
Kristian Høgsberg | d2412e2 | 2008-12-15 20:35:24 -0500 | [diff] [blame] | 58 | struct wl_compositor * |
| 59 | wl_display_get_compositor(struct wl_display *display); |
Kristian Høgsberg | de31d5c | 2008-12-18 17:55:33 -0500 | [diff] [blame] | 60 | struct wl_visual * |
| 61 | wl_display_get_argb_visual(struct wl_display *display); |
| 62 | struct wl_visual * |
| 63 | wl_display_get_premultiplied_argb_visual(struct wl_display *display); |
| 64 | struct wl_visual * |
| 65 | wl_display_get_rgb_visual(struct wl_display *display); |
Kristian Høgsberg | d2412e2 | 2008-12-15 20:35:24 -0500 | [diff] [blame] | 66 | |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 67 | struct wl_compositor_listener { |
| 68 | void (*acknowledge)(void *data, |
| 69 | struct wl_compositor *compositor, |
| 70 | uint32_t key, uint32_t frame); |
| 71 | void (*frame)(void *data, |
| 72 | struct wl_compositor *compositor, |
| 73 | uint32_t frame, uint32_t timestamp); |
| 74 | }; |
| 75 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 76 | struct wl_surface * |
Kristian Høgsberg | d2412e2 | 2008-12-15 20:35:24 -0500 | [diff] [blame] | 77 | wl_compositor_create_surface(struct wl_compositor *compositor); |
Kristian Høgsberg | 4097923 | 2008-11-25 22:40:39 -0500 | [diff] [blame] | 78 | void |
Kristian Høgsberg | d2412e2 | 2008-12-15 20:35:24 -0500 | [diff] [blame] | 79 | wl_compositor_commit(struct wl_compositor *compositor, uint32_t key); |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 80 | int |
| 81 | wl_compositor_add_listener(struct wl_compositor *compostior, |
| 82 | const struct wl_compositor_listener *listener, |
| 83 | void *data); |
| 84 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 85 | |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 86 | void wl_surface_destroy(struct wl_surface *surface); |
Kristian Høgsberg | de31d5c | 2008-12-18 17:55:33 -0500 | [diff] [blame] | 87 | void wl_surface_attach(struct wl_surface *surface, uint32_t name, |
| 88 | int32_t width, int32_t height, uint32_t stride, |
| 89 | struct wl_visual *visual); |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 90 | void wl_surface_map(struct wl_surface *surface, |
| 91 | int32_t x, int32_t y, int32_t width, int32_t height); |
Kristian Høgsberg | 7f77bd8 | 2008-11-07 08:39:37 -0500 | [diff] [blame] | 92 | void wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y, |
| 93 | uint32_t name, uint32_t stride, |
| 94 | int32_t x, int32_t y, int32_t width, int32_t height); |
| 95 | void wl_surface_damage(struct wl_surface *surface, |
| 96 | int32_t x, int32_t y, int32_t width, int32_t height); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 97 | |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 98 | struct wl_output; |
| 99 | struct wl_output_listener { |
| 100 | void (*geometry)(void *data, |
| 101 | struct wl_output *output, |
| 102 | int32_t width, int32_t height); |
| 103 | }; |
| 104 | |
| 105 | int |
| 106 | wl_output_add_listener(struct wl_output *output, |
| 107 | const struct wl_output_listener *listener, |
| 108 | void *data); |
| 109 | |
| 110 | struct wl_input_device; |
| 111 | struct wl_input_device_listener { |
| 112 | void (*motion)(void *data, |
| 113 | struct wl_input_device *input_device, |
| 114 | int32_t x, int32_t y, int32_t sx, int32_t sy); |
| 115 | void (*button)(void *data, |
| 116 | struct wl_input_device *input_device, |
| 117 | uint32_t button, uint32_t state, |
| 118 | int32_t x, int32_t y, int32_t sx, int32_t sy); |
| 119 | void (*key)(void *data, |
| 120 | struct wl_input_device *input_device, |
| 121 | uint32_t button, uint32_t state); |
Kristian Høgsberg | db6c2f3 | 2009-02-22 21:51:24 -0500 | [diff] [blame^] | 122 | void (*pointer_focus)(void *data, |
| 123 | struct wl_input_device *input_device, |
| 124 | struct wl_surface *surface); |
| 125 | void (*keyboard_focus)(void *data, |
| 126 | struct wl_input_device *input_device, |
| 127 | struct wl_surface *surface); |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 128 | }; |
| 129 | |
| 130 | int |
| 131 | wl_input_device_add_listener(struct wl_input_device *input_device, |
| 132 | const struct wl_input_device_listener *listener, |
| 133 | void *data); |
| 134 | |
Kristian Høgsberg | 1e4b86a | 2008-11-23 23:41:08 -0500 | [diff] [blame] | 135 | |
| 136 | /* These entry points are for client side implementation of custom |
| 137 | * objects. */ |
| 138 | |
| 139 | uint32_t wl_display_get_object_id(struct wl_display *display, |
Kristian Høgsberg | 8049cbb | 2008-12-21 22:50:32 -0500 | [diff] [blame] | 140 | const char *interface, uint32_t version); |
Kristian Høgsberg | 1e4b86a | 2008-11-23 23:41:08 -0500 | [diff] [blame] | 141 | uint32_t wl_display_allocate_id(struct wl_display *display); |
| 142 | void wl_display_write(struct wl_display *display, |
| 143 | const void *data, |
| 144 | size_t count); |
Kristian Høgsberg | 94448c0 | 2008-12-30 11:03:33 -0500 | [diff] [blame] | 145 | void wl_display_advertise_global(struct wl_display *display, |
| 146 | struct wl_object *object); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 147 | #endif |