blob: 7bafd5625f768054b0e25240ada82dc18740c016 [file] [log] [blame]
Kristian Høgsberga67a71a2008-10-07 10:10:36 -04001#ifndef _WAYLAND_CLIENT_H
2#define _WAYLAND_CLIENT_H
3
Kristian Høgsbergb7a01922008-11-08 15:39:41 -05004/* GCC visibility */
5#if defined(__GNUC__) && __GNUC__ >= 4
6#define WL_EXPORT __attribute__ ((visibility("default")))
7#else
8#define WL_EXPORT
9#endif
10
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040011struct wl_display;
12struct wl_surface;
13
Kristian Høgsbergfb590842008-11-07 14:27:23 -050014#define WL_DISPLAY_READABLE 0x01
15#define WL_DISPLAY_WRITABLE 0x02
16
17typedef int (*wl_display_update_func_t)(uint32_t mask, void *data);
18
19struct wl_display *wl_display_create(const char *address);
Kristian Høgsberg427524a2008-10-08 13:32:07 -040020void wl_display_destroy(struct wl_display *display);
Kristian Høgsbergfb590842008-11-07 14:27:23 -050021int wl_display_get_fd(struct wl_display *display,
22 wl_display_update_func_t update, void *data);
23
Kristian Høgsberg427524a2008-10-08 13:32:07 -040024void wl_display_iterate(struct wl_display *display, uint32_t mask);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040025
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -050026typedef void (*wl_display_event_func_t)(struct wl_display *display,
Kristian Høgsberg40979232008-11-25 22:40:39 -050027 uint32_t object,
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -050028 uint32_t opcode,
Kristian Høgsberg40979232008-11-25 22:40:39 -050029 uint32_t size,
30 uint32_t *p,
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -050031 void *data);
32
33void wl_display_set_event_handler(struct wl_display *display,
34 wl_display_event_func_t handler,
35 void *data);
36
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040037struct wl_surface *
38wl_display_create_surface(struct wl_display *display);
Kristian Høgsberg40979232008-11-25 22:40:39 -050039void
40wl_display_commit(struct wl_display *display, uint32_t key);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040041
Kristian Høgsberg05eff512008-10-07 10:10:36 -040042void wl_surface_destroy(struct wl_surface *surface);
43void wl_surface_attach(struct wl_surface *surface,
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -050044 uint32_t name, int32_t width, int32_t height, uint32_t stride);
Kristian Høgsberg05eff512008-10-07 10:10:36 -040045void wl_surface_map(struct wl_surface *surface,
46 int32_t x, int32_t y, int32_t width, int32_t height);
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -050047void wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y,
48 uint32_t name, uint32_t stride,
49 int32_t x, int32_t y, int32_t width, int32_t height);
50void wl_surface_damage(struct wl_surface *surface,
51 int32_t x, int32_t y, int32_t width, int32_t height);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040052
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -050053
54/* These entry points are for client side implementation of custom
55 * objects. */
56
57uint32_t wl_display_get_object_id(struct wl_display *display,
58 const char *interface);
59uint32_t wl_display_allocate_id(struct wl_display *display);
60void wl_display_write(struct wl_display *display,
61 const void *data,
62 size_t count);
63
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040064#endif