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 | b7a0192 | 2008-11-08 15:39:41 -0500 | [diff] [blame] | 26 | /* GCC visibility */ |
| 27 | #if defined(__GNUC__) && __GNUC__ >= 4 |
| 28 | #define WL_EXPORT __attribute__ ((visibility("default"))) |
| 29 | #else |
| 30 | #define WL_EXPORT |
| 31 | #endif |
| 32 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 33 | struct wl_display; |
| 34 | struct wl_surface; |
| 35 | |
Kristian Høgsberg | fb59084 | 2008-11-07 14:27:23 -0500 | [diff] [blame] | 36 | #define WL_DISPLAY_READABLE 0x01 |
| 37 | #define WL_DISPLAY_WRITABLE 0x02 |
| 38 | |
| 39 | typedef int (*wl_display_update_func_t)(uint32_t mask, void *data); |
| 40 | |
Kristian Høgsberg | dc0f355 | 2008-12-07 15:22:22 -0500 | [diff] [blame] | 41 | 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] | 42 | void wl_display_destroy(struct wl_display *display); |
Kristian Høgsberg | fb59084 | 2008-11-07 14:27:23 -0500 | [diff] [blame] | 43 | int wl_display_get_fd(struct wl_display *display, |
| 44 | wl_display_update_func_t update, void *data); |
| 45 | |
Kristian Høgsberg | 427524a | 2008-10-08 13:32:07 -0400 | [diff] [blame] | 46 | void wl_display_iterate(struct wl_display *display, uint32_t mask); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 47 | |
Kristian Høgsberg | 5a27f3e | 2008-11-02 10:55:25 -0500 | [diff] [blame] | 48 | typedef void (*wl_display_event_func_t)(struct wl_display *display, |
Kristian Høgsberg | 4097923 | 2008-11-25 22:40:39 -0500 | [diff] [blame] | 49 | uint32_t object, |
Kristian Høgsberg | 5a27f3e | 2008-11-02 10:55:25 -0500 | [diff] [blame] | 50 | uint32_t opcode, |
Kristian Høgsberg | 4097923 | 2008-11-25 22:40:39 -0500 | [diff] [blame] | 51 | uint32_t size, |
| 52 | uint32_t *p, |
Kristian Høgsberg | 5a27f3e | 2008-11-02 10:55:25 -0500 | [diff] [blame] | 53 | void *data); |
| 54 | |
| 55 | void wl_display_set_event_handler(struct wl_display *display, |
| 56 | wl_display_event_func_t handler, |
| 57 | void *data); |
| 58 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 59 | struct wl_surface * |
| 60 | wl_display_create_surface(struct wl_display *display); |
Kristian Høgsberg | 4097923 | 2008-11-25 22:40:39 -0500 | [diff] [blame] | 61 | void |
| 62 | wl_display_commit(struct wl_display *display, uint32_t key); |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 63 | |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 64 | void wl_surface_destroy(struct wl_surface *surface); |
| 65 | void wl_surface_attach(struct wl_surface *surface, |
Kristian Høgsberg | 7f77bd8 | 2008-11-07 08:39:37 -0500 | [diff] [blame] | 66 | uint32_t name, int32_t width, int32_t height, uint32_t stride); |
Kristian Høgsberg | 05eff51 | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 67 | void wl_surface_map(struct wl_surface *surface, |
| 68 | 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] | 69 | void wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y, |
| 70 | uint32_t name, uint32_t stride, |
| 71 | int32_t x, int32_t y, int32_t width, int32_t height); |
| 72 | void wl_surface_damage(struct wl_surface *surface, |
| 73 | 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] | 74 | |
Kristian Høgsberg | 1e4b86a | 2008-11-23 23:41:08 -0500 | [diff] [blame] | 75 | |
| 76 | /* These entry points are for client side implementation of custom |
| 77 | * objects. */ |
| 78 | |
| 79 | uint32_t wl_display_get_object_id(struct wl_display *display, |
| 80 | const char *interface); |
| 81 | uint32_t wl_display_allocate_id(struct wl_display *display); |
| 82 | void wl_display_write(struct wl_display *display, |
| 83 | const void *data, |
| 84 | size_t count); |
| 85 | |
Kristian Høgsberg | a67a71a | 2008-10-07 10:10:36 -0400 | [diff] [blame] | 86 | #endif |