blob: fd1583998ae9808e435fe05faf6361422a5ecbee [file] [log] [blame]
Kristian Høgsbergffd710e2008-12-02 15:15:01 -05001/*
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øgsberga67a71a2008-10-07 10:10:36 -040023#ifndef _WAYLAND_CLIENT_H
24#define _WAYLAND_CLIENT_H
25
Kristian Høgsbergb7a01922008-11-08 15:39:41 -050026/* 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øgsberga67a71a2008-10-07 10:10:36 -040033struct wl_display;
34struct wl_surface;
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -050035struct wl_visual;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040036
Kristian Høgsbergfb590842008-11-07 14:27:23 -050037#define WL_DISPLAY_READABLE 0x01
38#define WL_DISPLAY_WRITABLE 0x02
39
40typedef int (*wl_display_update_func_t)(uint32_t mask, void *data);
41
Kristian Høgsbergdc0f3552008-12-07 15:22:22 -050042struct wl_display *wl_display_create(const char *name, size_t name_size);
Kristian Høgsberg427524a2008-10-08 13:32:07 -040043void wl_display_destroy(struct wl_display *display);
Kristian Høgsbergfb590842008-11-07 14:27:23 -050044int wl_display_get_fd(struct wl_display *display,
45 wl_display_update_func_t update, void *data);
46
Kristian Høgsberg427524a2008-10-08 13:32:07 -040047void wl_display_iterate(struct wl_display *display, uint32_t mask);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040048
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -050049typedef void (*wl_display_event_func_t)(struct wl_display *display,
Kristian Høgsberg40979232008-11-25 22:40:39 -050050 uint32_t object,
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -050051 uint32_t opcode,
Kristian Høgsberg40979232008-11-25 22:40:39 -050052 uint32_t size,
53 uint32_t *p,
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -050054 void *data);
55
56void wl_display_set_event_handler(struct wl_display *display,
57 wl_display_event_func_t handler,
58 void *data);
59
Kristian Høgsbergee02ca62008-12-21 23:37:12 -050060void
61wl_display_get_geometry(struct wl_display *display,
62 int32_t *width, int32_t *height);
Kristian Høgsbergd2412e22008-12-15 20:35:24 -050063struct wl_compositor *
64wl_display_get_compositor(struct wl_display *display);
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -050065struct wl_visual *
66wl_display_get_argb_visual(struct wl_display *display);
67struct wl_visual *
68wl_display_get_premultiplied_argb_visual(struct wl_display *display);
69struct wl_visual *
70wl_display_get_rgb_visual(struct wl_display *display);
Kristian Høgsbergd2412e22008-12-15 20:35:24 -050071
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040072struct wl_surface *
Kristian Høgsbergd2412e22008-12-15 20:35:24 -050073wl_compositor_create_surface(struct wl_compositor *compositor);
Kristian Høgsberg40979232008-11-25 22:40:39 -050074void
Kristian Høgsbergd2412e22008-12-15 20:35:24 -050075wl_compositor_commit(struct wl_compositor *compositor, uint32_t key);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040076
Kristian Høgsberg05eff512008-10-07 10:10:36 -040077void wl_surface_destroy(struct wl_surface *surface);
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -050078void wl_surface_attach(struct wl_surface *surface, uint32_t name,
79 int32_t width, int32_t height, uint32_t stride,
80 struct wl_visual *visual);
Kristian Høgsberg05eff512008-10-07 10:10:36 -040081void wl_surface_map(struct wl_surface *surface,
82 int32_t x, int32_t y, int32_t width, int32_t height);
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -050083void wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y,
84 uint32_t name, uint32_t stride,
85 int32_t x, int32_t y, int32_t width, int32_t height);
86void wl_surface_damage(struct wl_surface *surface,
87 int32_t x, int32_t y, int32_t width, int32_t height);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040088
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -050089
90/* These entry points are for client side implementation of custom
91 * objects. */
92
93uint32_t wl_display_get_object_id(struct wl_display *display,
Kristian Høgsberg8049cbb2008-12-21 22:50:32 -050094 const char *interface, uint32_t version);
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -050095uint32_t wl_display_allocate_id(struct wl_display *display);
96void wl_display_write(struct wl_display *display,
97 const void *data,
98 size_t count);
99
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400100#endif