2 * Copyright © 2008 Kristian Høgsberg
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.
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
23 #ifndef _WAYLAND_CLIENT_H
24 #define _WAYLAND_CLIENT_H
35 #define WL_DISPLAY_READABLE 0x01
36 #define WL_DISPLAY_WRITABLE 0x02
39 wl_object_implements(struct wl_object *object,
40 const char *interface, int version);
42 typedef int (*wl_display_update_func_t)(uint32_t mask, void *data);
44 struct wl_display *wl_display_create(const char *name, size_t name_size);
45 void wl_display_destroy(struct wl_display *display);
46 int wl_display_get_fd(struct wl_display *display,
47 wl_display_update_func_t update, void *data);
49 void wl_display_iterate(struct wl_display *display, uint32_t mask);
51 struct wl_global_listener;
52 typedef void (*wl_display_global_func_t)(struct wl_display *display,
53 struct wl_object *object,
56 wl_display_remove_global_listener(struct wl_display *display,
57 struct wl_global_listener *listener);
59 struct wl_global_listener *
60 wl_display_add_global_listener(struct wl_display *display,
61 wl_display_global_func_t handler, void *data);
62 struct wl_compositor *
63 wl_display_get_compositor(struct wl_display *display);
65 wl_display_get_argb_visual(struct wl_display *display);
67 wl_display_get_premultiplied_argb_visual(struct wl_display *display);
69 wl_display_get_rgb_visual(struct wl_display *display);
71 struct wl_compositor_listener {
72 void (*device)(void *data,
73 struct wl_compositor *compositor,
75 void (*acknowledge)(void *data,
76 struct wl_compositor *compositor,
77 uint32_t key, uint32_t frame);
78 void (*frame)(void *data,
79 struct wl_compositor *compositor,
80 uint32_t frame, uint32_t timestamp);
84 wl_compositor_create_surface(struct wl_compositor *compositor);
86 wl_compositor_commit(struct wl_compositor *compositor, uint32_t key);
88 wl_compositor_add_listener(struct wl_compositor *compostior,
89 const struct wl_compositor_listener *listener,
93 void wl_surface_destroy(struct wl_surface *surface);
94 void wl_surface_attach(struct wl_surface *surface, uint32_t name,
95 int32_t width, int32_t height, uint32_t stride,
96 struct wl_visual *visual);
97 void wl_surface_map(struct wl_surface *surface,
98 int32_t x, int32_t y, int32_t width, int32_t height);
99 void wl_surface_damage(struct wl_surface *surface,
100 int32_t x, int32_t y, int32_t width, int32_t height);
102 void wl_surface_set_user_data(struct wl_surface *surface, void *user_data);
103 void *wl_surface_get_user_data(struct wl_surface *surface);
106 struct wl_output_listener {
107 void (*geometry)(void *data,
108 struct wl_output *output,
109 int32_t width, int32_t height);
113 wl_output_add_listener(struct wl_output *output,
114 const struct wl_output_listener *listener,
117 struct wl_input_device;
118 struct wl_input_device_listener {
119 void (*motion)(void *data,
120 struct wl_input_device *input_device,
121 int32_t x, int32_t y, int32_t sx, int32_t sy);
122 void (*button)(void *data,
123 struct wl_input_device *input_device,
124 uint32_t button, uint32_t state,
125 int32_t x, int32_t y, int32_t sx, int32_t sy);
126 void (*key)(void *data,
127 struct wl_input_device *input_device,
128 uint32_t button, uint32_t state);
129 void (*pointer_focus)(void *data,
130 struct wl_input_device *input_device,
131 struct wl_surface *surface);
132 void (*keyboard_focus)(void *data,
133 struct wl_input_device *input_device,
134 struct wl_surface *surface,
135 struct wl_array *keys);
139 wl_input_device_add_listener(struct wl_input_device *input_device,
140 const struct wl_input_device_listener *listener,
144 /* These entry points are for client side implementation of custom
147 uint32_t wl_display_get_object_id(struct wl_display *display,
148 const char *interface, uint32_t version);
149 uint32_t wl_display_allocate_id(struct wl_display *display);
150 void wl_display_write(struct wl_display *display,
153 void wl_display_advertise_global(struct wl_display *display,
154 struct wl_object *object);