blob: 8a597f559294c06a4b13e74998fd40d8a6e1ea20 [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#include <stdlib.h>
24#include <stdint.h>
25#include <stddef.h>
26#include <stdio.h>
27#include <errno.h>
28#include <string.h>
29#include <unistd.h>
30#include <sys/socket.h>
31#include <sys/un.h>
32#include <ctype.h>
Kristian Høgsbergfe831a72008-12-21 21:50:23 -050033#include <assert.h>
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040034#include <sys/poll.h>
35
Kristian Høgsbergfe831a72008-12-21 21:50:23 -050036#include "wayland-protocol.h"
Kristian Høgsberg427524a2008-10-08 13:32:07 -040037#include "connection.h"
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -050038#include "wayland-util.h"
Kristian Høgsberg427524a2008-10-08 13:32:07 -040039#include "wayland-client.h"
40
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040041static const char socket_name[] = "\0wayland";
42
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -050043struct wl_global {
44 uint32_t id;
45 char *interface;
Kristian Høgsbergbf967b42008-12-21 20:25:16 -050046 uint32_t version;
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -050047 struct wl_list link;
48};
49
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040050struct wl_proxy {
Kristian Høgsbergfe831a72008-12-21 21:50:23 -050051 const struct wl_interface *interface;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040052 uint32_t id;
Kristian Høgsbergfe831a72008-12-21 21:50:23 -050053 struct wl_display *display;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040054};
55
56struct wl_display {
57 struct wl_proxy proxy;
Kristian Høgsberg427524a2008-10-08 13:32:07 -040058 struct wl_connection *connection;
59 int fd;
Kristian Høgsberg97079ad2008-12-21 22:45:33 -050060 uint32_t id, id_count, next_range;
Kristian Høgsbergfb590842008-11-07 14:27:23 -050061 uint32_t mask;
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -050062 struct wl_list global_list;
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -050063 struct wl_list visual_list;
Kristian Høgsbergfb590842008-11-07 14:27:23 -050064
65 wl_display_update_func_t update;
66 void *update_data;
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -050067
68 wl_display_event_func_t event_handler;
69 void *event_handler_data;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040070};
71
Kristian Høgsbergd2412e22008-12-15 20:35:24 -050072struct wl_compositor {
73 struct wl_proxy proxy;
74};
75
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040076struct wl_surface {
77 struct wl_proxy proxy;
78};
79
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -050080struct wl_visual {
81 struct wl_proxy proxy;
82 struct wl_list link;
83};
84
Kristian Høgsbergfb590842008-11-07 14:27:23 -050085static int
86connection_update(struct wl_connection *connection,
87 uint32_t mask, void *data)
88{
89 struct wl_display *display = data;
90
91 display->mask = mask;
92 if (display->update)
93 return display->update(display->mask,
94 display->update_data);
95
96 return 0;
97}
98
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -050099static void
100add_visual(struct wl_display *display, struct wl_global *global)
101{
102 struct wl_visual *visual;
103
104 visual = malloc(sizeof *visual);
105 if (visual == NULL)
106 return;
107
108 visual->proxy.display = display;
109 visual->proxy.id = global->id;
110 wl_list_insert(display->visual_list.prev, &visual->link);
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -0500111}
112
113WL_EXPORT struct wl_visual *
114wl_display_get_argb_visual(struct wl_display *display)
115{
116 return container_of(display->visual_list.next,
117 struct wl_visual, link);
118}
119
120WL_EXPORT struct wl_visual *
121wl_display_get_premultiplied_argb_visual(struct wl_display *display)
122{
123 return container_of(display->visual_list.next->next,
124 struct wl_visual, link);
125}
126
127WL_EXPORT struct wl_visual *
128wl_display_get_rgb_visual(struct wl_display *display)
129{
130 /* FIXME: Where's cddar when you need it... */
131
132 return container_of(display->visual_list.next->next->next,
133 struct wl_visual, link);
134}
135
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500136WL_EXPORT struct wl_display *
Kristian Høgsbergdc0f3552008-12-07 15:22:22 -0500137wl_display_create(const char *name, size_t name_size)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400138{
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400139 struct wl_display *display;
Kristian Høgsbergdc0f3552008-12-07 15:22:22 -0500140 struct sockaddr_un addr;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400141 socklen_t size;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400142
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400143 display = malloc(sizeof *display);
144 if (display == NULL)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400145 return NULL;
146
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400147 memset(display, 0, sizeof *display);
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400148 display->fd = socket(PF_LOCAL, SOCK_STREAM, 0);
149 if (display->fd < 0) {
150 free(display);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400151 return NULL;
152 }
153
Kristian Høgsbergdc0f3552008-12-07 15:22:22 -0500154 addr.sun_family = AF_LOCAL;
155 memcpy(addr.sun_path, name, name_size);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400156
Kristian Høgsbergdc0f3552008-12-07 15:22:22 -0500157 size = offsetof (struct sockaddr_un, sun_path) + name_size;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400158
Kristian Høgsbergdc0f3552008-12-07 15:22:22 -0500159 if (connect(display->fd, (struct sockaddr *) &addr, size) < 0) {
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400160 close(display->fd);
161 free(display);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400162 return NULL;
163 }
164
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -0500165 wl_list_init(&display->global_list);
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -0500166 wl_list_init(&display->visual_list);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400167
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500168 display->proxy.interface = &wl_display_interface;
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -0500169 display->proxy.id = wl_display_get_object_id(display, "display");
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500170 display->proxy.display = display;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400171
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400172 display->connection = wl_connection_create(display->fd,
Kristian Høgsbergfb590842008-11-07 14:27:23 -0500173 connection_update,
174 display);
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400175
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500176 /* Process connection events. */
177 wl_display_iterate(display, WL_CONNECTION_READABLE);
178
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400179 return display;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400180}
181
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500182WL_EXPORT void
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400183wl_display_destroy(struct wl_display *display)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400184{
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400185 wl_connection_destroy(display->connection);
186 close(display->fd);
187 free(display);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400188}
189
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -0500190WL_EXPORT uint32_t
191wl_display_get_object_id(struct wl_display *display, const char *interface)
192{
193 struct wl_global *global;
194
195 global = container_of(display->global_list.next,
196 struct wl_global, link);
197 while (&global->link != &display->global_list) {
198 if (strcmp(global->interface, interface) == 0)
199 return global->id;
200
201 global = container_of(global->link.next,
202 struct wl_global, link);
203 }
204
205 return 0;
206}
207
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500208WL_EXPORT int
Kristian Høgsbergfb590842008-11-07 14:27:23 -0500209wl_display_get_fd(struct wl_display *display,
210 wl_display_update_func_t update, void *data)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400211{
Kristian Høgsbergfb590842008-11-07 14:27:23 -0500212 display->update = update;
213 display->update_data = data;
214
215 display->update(display->mask, display->update_data);
216
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400217 return display->fd;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400218}
219
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500220static void
Kristian Høgsberg97079ad2008-12-21 22:45:33 -0500221handle_display_event(struct wl_display *display,
222 uint32_t opcode, uint32_t *p, uint32_t size)
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500223{
224 struct wl_global *global;
225 uint32_t length;
226
Kristian Høgsberg97079ad2008-12-21 22:45:33 -0500227 switch (opcode) {
228 case WL_DISPLAY_INVALID_OBJECT:
229 fprintf(stderr, "sent request to invalid object\n");
230 break;
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500231
Kristian Høgsberg97079ad2008-12-21 22:45:33 -0500232 case WL_DISPLAY_INVALID_METHOD:
233 fprintf(stderr, "sent invalid request opcode\n");
234 break;
235
236 case WL_DISPLAY_NO_MEMORY:
237 fprintf(stderr, "server out of memory\n");
238 break;
239
240 case WL_DISPLAY_GLOBAL:
241 global = malloc(sizeof *global);
242 if (global == NULL)
243 return;
244
245 global->id = p[0];
246 length = p[1];
247 global->interface = malloc(length + 1);
248 if (global->interface == NULL) {
249 free(global);
250 return;
251 }
252 memcpy(global->interface, &p[2], length);
253 global->interface[length] = '\0';
254 global->version = p[2 + DIV_ROUNDUP(length, sizeof *p)];
255 wl_list_insert(display->global_list.prev, &global->link);
256
257 if (strcmp(global->interface, "visual") == 0)
258 add_visual(display, global);
259 break;
260
261 case WL_DISPLAY_RANGE:
262 display->next_range = p[0];
263 break;
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500264 }
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500265}
266
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400267static void
Kristian Høgsberg40979232008-11-25 22:40:39 -0500268handle_event(struct wl_display *display,
269 uint32_t object, uint32_t opcode, uint32_t size)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400270{
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500271 uint32_t p[32];
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400272
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -0500273 wl_connection_copy(display->connection, p, size);
Kristian Høgsberg97079ad2008-12-21 22:45:33 -0500274 if (object == 1) {
275 handle_display_event(display, opcode, p + 2, size);
Kristian Høgsbergbf967b42008-12-21 20:25:16 -0500276 } else if (display->event_handler != NULL)
Kristian Høgsberg40979232008-11-25 22:40:39 -0500277 display->event_handler(display, object, opcode, size, p + 2,
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -0500278 display->event_handler_data);
279 wl_connection_consume(display->connection, size);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400280}
281
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500282WL_EXPORT void
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400283wl_display_iterate(struct wl_display *display, uint32_t mask)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400284{
Kristian Høgsberg40979232008-11-25 22:40:39 -0500285 uint32_t p[2], object, opcode, size;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400286 int len;
287
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400288 len = wl_connection_data(display->connection, mask);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400289 while (len > 0) {
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400290 if (len < sizeof p)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400291 break;
292
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400293 wl_connection_copy(display->connection, p, sizeof p);
Kristian Høgsberg40979232008-11-25 22:40:39 -0500294 object = p[0];
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400295 opcode = p[1] & 0xffff;
296 size = p[1] >> 16;
Kristian Høgsberg427524a2008-10-08 13:32:07 -0400297 if (len < size)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400298 break;
299
Kristian Høgsberg40979232008-11-25 22:40:39 -0500300 handle_event(display, object, opcode, size);
Kristian Høgsbergf9bc7952008-11-02 10:12:29 -0500301 len -= size;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400302 }
303
304 if (len < 0) {
305 fprintf(stderr, "read error: %m\n");
306 exit(EXIT_FAILURE);
307 }
308}
309
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500310WL_EXPORT void
Kristian Høgsberg5a27f3e2008-11-02 10:55:25 -0500311wl_display_set_event_handler(struct wl_display *display,
312 wl_display_event_func_t handler,
313 void *data)
314{
315 /* FIXME: This needs something more generic... */
316 display->event_handler = handler;
317 display->event_handler_data = data;
318}
319
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -0500320WL_EXPORT uint32_t
321wl_display_allocate_id(struct wl_display *display)
322{
Kristian Høgsberg97079ad2008-12-21 22:45:33 -0500323 if (display->id_count == 0) {
324 display->id_count = 256;
325 display->id = display->next_range;
326 }
327
328 display->id_count--;
329
Kristian Høgsberg1e4b86a2008-11-23 23:41:08 -0500330 return display->id++;
331}
332
333WL_EXPORT void
334wl_display_write(struct wl_display *display, const void *data, size_t count)
335{
336 wl_connection_write(display->connection, data, count);
337}
338
Kristian Høgsbergd2412e22008-12-15 20:35:24 -0500339WL_EXPORT struct wl_compositor *
340wl_display_get_compositor(struct wl_display *display)
341{
342 struct wl_compositor *compositor;
343 uint32_t id;
344
345 id = wl_display_get_object_id(display, "compositor");
346 if (id == 0)
347 return NULL;
348
349 compositor = malloc(sizeof *compositor);
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500350 compositor->proxy.interface = &wl_compositor_interface;
Kristian Høgsbergd2412e22008-12-15 20:35:24 -0500351 compositor->proxy.id = id;
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500352 compositor->proxy.display = display;
Kristian Høgsbergd2412e22008-12-15 20:35:24 -0500353
354 return compositor;
355}
356
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500357static void
358wl_proxy_vmarshal(struct wl_proxy *target, uint32_t opcode, va_list ap)
359{
360 struct wl_proxy *proxy;
361 uint32_t args[32], length, *p, size;
362 const char *s, *signature;
363 int i, count;
364
365 signature = target->interface->methods[opcode].signature;
366 count = strlen(signature);
367 /* FIXME: Make sure we don't overwrite args array. */
368
369 p = &args[2];
370 for (i = 0; i < count; i++) {
371 switch (signature[i]) {
372 case 'u':
373 case 'i':
374 *p++ = va_arg(ap, uint32_t);
375 break;
376 case 's':
377 s = va_arg(ap, const char *);
378 length = strlen(s);
379 *p++ = length;
380 memcpy(p, s, length);
381 p += DIV_ROUNDUP(length, sizeof(*p));
382 break;
383 case 'n':
384 case 'o':
385 proxy = va_arg(ap, struct wl_proxy *);
386 *p++ = proxy->id;
387 break;
388 default:
389 assert(0);
390 break;
391 }
392 }
393
394 size = (p - args) * sizeof *p;
395 args[0] = target->id;
396 args[1] = opcode | (size << 16);
397 wl_connection_write(target->display->connection, args, size);
398}
399
400static void
401wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
402{
403 va_list ap;
404
405 va_start(ap, opcode);
406 wl_proxy_vmarshal(proxy, opcode, ap);
407 va_end(ap);
408}
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400409
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500410WL_EXPORT struct wl_surface *
Kristian Høgsbergd2412e22008-12-15 20:35:24 -0500411wl_compositor_create_surface(struct wl_compositor *compositor)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400412{
413 struct wl_surface *surface;
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400414
415 surface = malloc(sizeof *surface);
416 if (surface == NULL)
417 return NULL;
418
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500419 surface->proxy.interface = &wl_surface_interface;
Kristian Høgsbergd2412e22008-12-15 20:35:24 -0500420 surface->proxy.id = wl_display_allocate_id(compositor->proxy.display);
421 surface->proxy.display = compositor->proxy.display;
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500422 wl_proxy_marshal(&compositor->proxy,
423 WL_COMPOSITOR_CREATE_SURFACE, surface);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400424
425 return surface;
426}
427
Kristian Høgsberg40979232008-11-25 22:40:39 -0500428WL_EXPORT void
Kristian Høgsbergd2412e22008-12-15 20:35:24 -0500429wl_compositor_commit(struct wl_compositor *compositor, uint32_t key)
Kristian Høgsberg40979232008-11-25 22:40:39 -0500430{
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500431 wl_proxy_marshal(&compositor->proxy, WL_COMPOSITOR_COMMIT, key);
Kristian Høgsberg40979232008-11-25 22:40:39 -0500432}
433
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500434WL_EXPORT void
435wl_surface_destroy(struct wl_surface *surface)
Kristian Høgsberg05eff512008-10-07 10:10:36 -0400436{
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500437 wl_proxy_marshal(&surface->proxy, WL_SURFACE_DESTROY);
Kristian Høgsberg05eff512008-10-07 10:10:36 -0400438}
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400439
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500440WL_EXPORT void
441wl_surface_attach(struct wl_surface *surface, uint32_t name,
Kristian Høgsbergde31d5c2008-12-18 17:55:33 -0500442 int32_t width, int32_t height, uint32_t stride,
443 struct wl_visual *visual)
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400444{
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500445 wl_proxy_marshal(&surface->proxy, WL_SURFACE_ATTACH,
446 name, width, height, stride, visual);
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400447}
Kristian Høgsberg05eff512008-10-07 10:10:36 -0400448
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500449WL_EXPORT void
450wl_surface_map(struct wl_surface *surface,
451 int32_t x, int32_t y, int32_t width, int32_t height)
Kristian Høgsberg05eff512008-10-07 10:10:36 -0400452{
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500453 wl_proxy_marshal(&surface->proxy,
454 WL_SURFACE_MAP, x, y, width, height);
Kristian Høgsberg05eff512008-10-07 10:10:36 -0400455}
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -0500456
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500457WL_EXPORT void
458wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y,
459 uint32_t name, uint32_t stride,
460 int32_t x, int32_t y, int32_t width, int32_t height)
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -0500461{
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500462 wl_proxy_marshal(&surface->proxy, WL_SURFACE_COPY,
463 dst_x, dst_y, name, stride, x, y, width, height);
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -0500464}
465
Kristian Høgsbergb7a01922008-11-08 15:39:41 -0500466WL_EXPORT void
467wl_surface_damage(struct wl_surface *surface,
468 int32_t x, int32_t y, int32_t width, int32_t height)
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -0500469{
Kristian Høgsbergfe831a72008-12-21 21:50:23 -0500470 wl_proxy_marshal(&surface->proxy,
471 WL_SURFACE_DAMAGE, x, y, width, height);
Kristian Høgsberg7f77bd82008-11-07 08:39:37 -0500472}