blob: 92cee9f0ed7aad05251876b35d1eaec98c5ed612 [file] [log] [blame]
U. Artie Eoff1ba9b382012-12-07 13:50:32 -08001/*
2 * Copyright © 2012 Intel Corporation
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øgsbergc7d2c4c2013-08-26 14:43:17 -070023#include <config.h>
24
U. Artie Eoff1ba9b382012-12-07 13:50:32 -080025#include <stdlib.h>
26#include <stdio.h>
27#include <string.h>
28#include <unistd.h>
Marek Chalupa4d06d462014-07-16 11:27:06 +020029#include <errno.h>
U. Artie Eoff1ba9b382012-12-07 13:50:32 -080030#include <sys/mman.h>
31
32#include "../shared/os-compatibility.h"
33#include "weston-test-client-helper.h"
34
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -070035static inline void *
36xzalloc(size_t size)
37{
38 void *p;
39
40 p = calloc(1, size);
41 assert(p);
42
43 return p;
44}
45
U. Artie Eoff1ba9b382012-12-07 13:50:32 -080046int
47surface_contains(struct surface *surface, int x, int y)
48{
49 /* test whether a global x,y point is contained in the surface */
50 int sx = surface->x;
51 int sy = surface->y;
52 int sw = surface->width;
53 int sh = surface->height;
54 return x >= sx && y >= sy && x < sx + sw && y < sy + sh;
55}
56
Kristian Høgsbergdb6dc7d2012-12-11 21:49:13 -050057static void
Pekka Paalanen8aaef7d2013-02-08 17:01:25 +020058frame_callback_handler(void *data, struct wl_callback *callback, uint32_t time)
Kristian Høgsbergdb6dc7d2012-12-11 21:49:13 -050059{
60 int *done = data;
61
62 *done = 1;
63
64 wl_callback_destroy(callback);
65}
66
67static const struct wl_callback_listener frame_listener = {
Pekka Paalanen8aaef7d2013-02-08 17:01:25 +020068 frame_callback_handler
Kristian Høgsbergdb6dc7d2012-12-11 21:49:13 -050069};
70
Pekka Paalanen8aaef7d2013-02-08 17:01:25 +020071struct wl_callback *
72frame_callback_set(struct wl_surface *surface, int *done)
73{
74 struct wl_callback *callback;
75
76 *done = 0;
77 callback = wl_surface_frame(surface);
78 wl_callback_add_listener(callback, &frame_listener, done);
79
80 return callback;
81}
82
83void
84frame_callback_wait(struct client *client, int *done)
85{
86 while (!*done) {
87 assert(wl_display_dispatch(client->wl_display) >= 0);
88 }
89}
90
U. Artie Eoff1ba9b382012-12-07 13:50:32 -080091void
92move_client(struct client *client, int x, int y)
93{
94 struct surface *surface = client->surface;
Kristian Høgsbergdb6dc7d2012-12-11 21:49:13 -050095 int done;
U. Artie Eoff1ba9b382012-12-07 13:50:32 -080096
97 client->surface->x = x;
98 client->surface->y = y;
99 wl_test_move_surface(client->test->wl_test, surface->wl_surface,
100 surface->x, surface->y);
Giulio Camuffo82cb5052013-02-28 18:44:54 +0100101 /* The attach here is necessary because commit() will call congfigure
102 * only on surfaces newly attached, and the one that sets the surface
103 * position is the configure. */
104 wl_surface_attach(surface->wl_surface, surface->wl_buffer, 0, 0);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800105 wl_surface_damage(surface->wl_surface, 0, 0, surface->width,
106 surface->height);
Kristian Høgsbergdb6dc7d2012-12-11 21:49:13 -0500107
Pekka Paalanen8aaef7d2013-02-08 17:01:25 +0200108 frame_callback_set(surface->wl_surface, &done);
Kristian Høgsbergdb6dc7d2012-12-11 21:49:13 -0500109
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800110 wl_surface_commit(surface->wl_surface);
111
Pekka Paalanen8aaef7d2013-02-08 17:01:25 +0200112 frame_callback_wait(client, &done);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800113}
114
Neil Roberts40c0c3f2013-10-29 20:13:45 +0000115int
116get_n_egl_buffers(struct client *client)
117{
118 client->test->n_egl_buffers = -1;
119
120 wl_test_get_n_egl_buffers(client->test->wl_test);
121 wl_display_roundtrip(client->wl_display);
122
123 return client->test->n_egl_buffers;
124}
125
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800126static void
127pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
128 uint32_t serial, struct wl_surface *wl_surface,
129 wl_fixed_t x, wl_fixed_t y)
130{
131 struct pointer *pointer = data;
132
133 pointer->focus = wl_surface_get_user_data(wl_surface);
134 pointer->x = wl_fixed_to_int(x);
135 pointer->y = wl_fixed_to_int(y);
136
137 fprintf(stderr, "test-client: got pointer enter %d %d, surface %p\n",
138 pointer->x, pointer->y, pointer->focus);
139}
140
141static void
142pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
143 uint32_t serial, struct wl_surface *wl_surface)
144{
145 struct pointer *pointer = data;
146
147 pointer->focus = NULL;
148
149 fprintf(stderr, "test-client: got pointer leave, surface %p\n",
150 wl_surface_get_user_data(wl_surface));
151}
152
153static void
154pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
155 uint32_t time, wl_fixed_t x, wl_fixed_t y)
156{
157 struct pointer *pointer = data;
158
159 pointer->x = wl_fixed_to_int(x);
160 pointer->y = wl_fixed_to_int(y);
161
162 fprintf(stderr, "test-client: got pointer motion %d %d\n",
163 pointer->x, pointer->y);
164}
165
166static void
167pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
168 uint32_t serial, uint32_t time, uint32_t button,
169 uint32_t state)
170{
171 struct pointer *pointer = data;
172
173 pointer->button = button;
174 pointer->state = state;
175
176 fprintf(stderr, "test-client: got pointer button %u %u\n",
177 button, state);
178}
179
180static void
181pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
182 uint32_t time, uint32_t axis, wl_fixed_t value)
183{
Kristian Høgsberg4c8ce202013-10-09 14:23:00 -0700184 fprintf(stderr, "test-client: got pointer axis %u %f\n",
185 axis, wl_fixed_to_double(value));
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800186}
187
188static const struct wl_pointer_listener pointer_listener = {
189 pointer_handle_enter,
190 pointer_handle_leave,
191 pointer_handle_motion,
192 pointer_handle_button,
193 pointer_handle_axis,
194};
195
196static void
197keyboard_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
198 uint32_t format, int fd, uint32_t size)
199{
200 close(fd);
201
202 fprintf(stderr, "test-client: got keyboard keymap\n");
203}
204
205static void
206keyboard_handle_enter(void *data, struct wl_keyboard *wl_keyboard,
207 uint32_t serial, struct wl_surface *wl_surface,
208 struct wl_array *keys)
209{
210 struct keyboard *keyboard = data;
211
212 keyboard->focus = wl_surface_get_user_data(wl_surface);
213
214 fprintf(stderr, "test-client: got keyboard enter, surface %p\n",
215 keyboard->focus);
216}
217
218static void
219keyboard_handle_leave(void *data, struct wl_keyboard *wl_keyboard,
220 uint32_t serial, struct wl_surface *wl_surface)
221{
222 struct keyboard *keyboard = data;
223
224 keyboard->focus = NULL;
225
226 fprintf(stderr, "test-client: got keyboard leave, surface %p\n",
227 wl_surface_get_user_data(wl_surface));
228}
229
230static void
231keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard,
232 uint32_t serial, uint32_t time, uint32_t key,
233 uint32_t state)
234{
235 struct keyboard *keyboard = data;
236
237 keyboard->key = key;
238 keyboard->state = state;
239
240 fprintf(stderr, "test-client: got keyboard key %u %u\n", key, state);
241}
242
243static void
244keyboard_handle_modifiers(void *data, struct wl_keyboard *wl_keyboard,
245 uint32_t serial, uint32_t mods_depressed,
246 uint32_t mods_latched, uint32_t mods_locked,
247 uint32_t group)
248{
249 struct keyboard *keyboard = data;
250
251 keyboard->mods_depressed = mods_depressed;
252 keyboard->mods_latched = mods_latched;
253 keyboard->mods_locked = mods_locked;
254 keyboard->group = group;
255
256 fprintf(stderr, "test-client: got keyboard modifiers %u %u %u %u\n",
257 mods_depressed, mods_latched, mods_locked, group);
258}
259
260static const struct wl_keyboard_listener keyboard_listener = {
261 keyboard_handle_keymap,
262 keyboard_handle_enter,
263 keyboard_handle_leave,
264 keyboard_handle_key,
265 keyboard_handle_modifiers,
266};
267
268static void
269surface_enter(void *data,
270 struct wl_surface *wl_surface, struct wl_output *output)
271{
272 struct surface *surface = data;
273
274 surface->output = wl_output_get_user_data(output);
275
276 fprintf(stderr, "test-client: got surface enter output %p\n",
277 surface->output);
278}
279
280static void
281surface_leave(void *data,
282 struct wl_surface *wl_surface, struct wl_output *output)
283{
284 struct surface *surface = data;
285
286 surface->output = NULL;
287
288 fprintf(stderr, "test-client: got surface leave output %p\n",
289 wl_output_get_user_data(output));
290}
291
292static const struct wl_surface_listener surface_listener = {
293 surface_enter,
294 surface_leave
295};
296
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200297struct wl_buffer *
298create_shm_buffer(struct client *client, int width, int height, void **pixels)
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800299{
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800300 struct wl_shm *shm = client->wl_shm;
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200301 int stride = width * 4;
302 int size = stride * height;
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800303 struct wl_shm_pool *pool;
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200304 struct wl_buffer *buffer;
305 int fd;
306 void *data;
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800307
308 fd = os_create_anonymous_file(size);
309 assert(fd >= 0);
310
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200311 data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
312 if (data == MAP_FAILED) {
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800313 close(fd);
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200314 assert(data != MAP_FAILED);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800315 }
316
317 pool = wl_shm_create_pool(shm, fd, size);
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200318 buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride,
319 WL_SHM_FORMAT_ARGB8888);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800320 wl_shm_pool_destroy(pool);
321
322 close(fd);
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200323
324 if (pixels)
325 *pixels = data;
326
327 return buffer;
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800328}
329
330static void
331shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
332{
333 struct client *client = data;
334
335 if (format == WL_SHM_FORMAT_ARGB8888)
336 client->has_argb = 1;
337}
338
339struct wl_shm_listener shm_listener = {
340 shm_format
341};
342
343static void
344test_handle_pointer_position(void *data, struct wl_test *wl_test,
345 wl_fixed_t x, wl_fixed_t y)
346{
347 struct test *test = data;
348 test->pointer_x = wl_fixed_to_int(x);
349 test->pointer_y = wl_fixed_to_int(y);
350
351 fprintf(stderr, "test-client: got global pointer %d %d\n",
352 test->pointer_x, test->pointer_y);
353}
354
Neil Roberts40c0c3f2013-10-29 20:13:45 +0000355static void
356test_handle_n_egl_buffers(void *data, struct wl_test *wl_test, uint32_t n)
357{
358 struct test *test = data;
359
360 test->n_egl_buffers = n;
361}
362
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800363static const struct wl_test_listener test_listener = {
Neil Roberts40c0c3f2013-10-29 20:13:45 +0000364 test_handle_pointer_position,
365 test_handle_n_egl_buffers,
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800366};
367
368static void
369seat_handle_capabilities(void *data, struct wl_seat *seat,
370 enum wl_seat_capability caps)
371{
372 struct input *input = data;
373 struct pointer *pointer;
374 struct keyboard *keyboard;
375
376 if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700377 pointer = xzalloc(sizeof *pointer);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800378 pointer->wl_pointer = wl_seat_get_pointer(seat);
379 wl_pointer_set_user_data(pointer->wl_pointer, pointer);
380 wl_pointer_add_listener(pointer->wl_pointer, &pointer_listener,
381 pointer);
382 input->pointer = pointer;
383 } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
384 wl_pointer_destroy(input->pointer->wl_pointer);
385 free(input->pointer);
386 input->pointer = NULL;
387 }
388
389 if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) {
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700390 keyboard = xzalloc(sizeof *keyboard);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800391 keyboard->wl_keyboard = wl_seat_get_keyboard(seat);
392 wl_keyboard_set_user_data(keyboard->wl_keyboard, keyboard);
393 wl_keyboard_add_listener(keyboard->wl_keyboard, &keyboard_listener,
394 keyboard);
395 input->keyboard = keyboard;
396 } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {
397 wl_keyboard_destroy(input->keyboard->wl_keyboard);
398 free(input->keyboard);
399 input->keyboard = NULL;
400 }
401}
402
403static const struct wl_seat_listener seat_listener = {
404 seat_handle_capabilities,
405};
406
407static void
408output_handle_geometry(void *data,
409 struct wl_output *wl_output,
410 int x, int y,
411 int physical_width,
412 int physical_height,
413 int subpixel,
414 const char *make,
415 const char *model,
416 int32_t transform)
417{
418 struct output *output = data;
419
420 output->x = x;
421 output->y = y;
422}
423
424static void
425output_handle_mode(void *data,
426 struct wl_output *wl_output,
427 uint32_t flags,
428 int width,
429 int height,
430 int refresh)
431{
432 struct output *output = data;
433
434 if (flags & WL_OUTPUT_MODE_CURRENT) {
435 output->width = width;
436 output->height = height;
437 }
438}
439
440static const struct wl_output_listener output_listener = {
441 output_handle_geometry,
442 output_handle_mode
443};
444
445static void
446handle_global(void *data, struct wl_registry *registry,
447 uint32_t id, const char *interface, uint32_t version)
448{
449 struct client *client = data;
450 struct input *input;
451 struct output *output;
452 struct test *test;
Kristian Høgsberg1cb3df42012-12-11 23:03:56 -0500453 struct global *global;
454
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700455 global = xzalloc(sizeof *global);
Kristian Høgsberg1cb3df42012-12-11 23:03:56 -0500456 global->name = id;
457 global->interface = strdup(interface);
458 assert(interface);
459 global->version = version;
460 wl_list_insert(client->global_list.prev, &global->link);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800461
462 if (strcmp(interface, "wl_compositor") == 0) {
463 client->wl_compositor =
464 wl_registry_bind(registry, id,
465 &wl_compositor_interface, 1);
466 } else if (strcmp(interface, "wl_seat") == 0) {
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700467 input = xzalloc(sizeof *input);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800468 input->wl_seat =
469 wl_registry_bind(registry, id,
470 &wl_seat_interface, 1);
471 wl_seat_add_listener(input->wl_seat, &seat_listener, input);
472 client->input = input;
473 } else if (strcmp(interface, "wl_shm") == 0) {
474 client->wl_shm =
475 wl_registry_bind(registry, id,
476 &wl_shm_interface, 1);
477 wl_shm_add_listener(client->wl_shm, &shm_listener, client);
478 } else if (strcmp(interface, "wl_output") == 0) {
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700479 output = xzalloc(sizeof *output);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800480 output->wl_output =
481 wl_registry_bind(registry, id,
482 &wl_output_interface, 1);
483 wl_output_add_listener(output->wl_output,
484 &output_listener, output);
485 client->output = output;
486 } else if (strcmp(interface, "wl_test") == 0) {
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700487 test = xzalloc(sizeof *test);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800488 test->wl_test =
489 wl_registry_bind(registry, id,
490 &wl_test_interface, 1);
491 wl_test_add_listener(test->wl_test, &test_listener, test);
492 client->test = test;
493 }
494}
495
496static const struct wl_registry_listener registry_listener = {
497 handle_global
498};
499
Kristian Høgsberg42284f52014-01-01 17:38:04 -0800500void
501skip(const char *fmt, ...)
502{
503 va_list argp;
504
505 va_start(argp, fmt);
506 vfprintf(stderr, fmt, argp);
507 va_end(argp);
508
Emilio Pozuelo Monfortdae8a4b2014-02-07 09:34:48 +0100509 /* automake tests uses exit code 77. weston-test-runner will see
510 * this and use it, and then weston-test's sigchld handler (in the
511 * weston process) will use that as an exit status, which is what
512 * automake will see in the end. */
513 exit(77);
Kristian Høgsberg42284f52014-01-01 17:38:04 -0800514}
515
Marek Chalupa4d06d462014-07-16 11:27:06 +0200516void
517expect_protocol_error(struct client *client,
518 const struct wl_interface *intf,
519 uint32_t code)
520{
521 int err;
522 uint32_t errcode, failed = 0;
523 const struct wl_interface *interface;
524 unsigned int id;
525
526 /* if the error has not come yet, make it happen */
527 wl_display_roundtrip(client->wl_display);
528
529 err = wl_display_get_error(client->wl_display);
530
531 assert(err && "Expected protocol error but nothing came");
532 assert(err == EPROTO && "Expected protocol error but got local error");
533
534 errcode = wl_display_get_protocol_error(client->wl_display,
535 &interface, &id);
536
537 /* check error */
538 if (errcode != code) {
539 fprintf(stderr, "Should get error code %d but got %d\n",
540 code, errcode);
541 failed = 1;
542 }
543
544 /* this should be definitely set */
545 assert(interface);
546
547 if (strcmp(intf->name, interface->name) != 0) {
548 fprintf(stderr, "Should get interface '%s' but got '%s'\n",
549 intf->name, interface->name);
550 failed = 1;
551 }
552
553 if (failed) {
554 fprintf(stderr, "Expected other protocol error\n");
555 abort();
556 }
557
558 /* all OK */
559 fprintf(stderr, "Got expected protocol error on '%s' (object id: %d) "
560 "with code %d\n", interface->name, id, errcode);
561}
562
Pekka Paalanen07921d72012-12-12 14:26:40 +0200563static void
564log_handler(const char *fmt, va_list args)
565{
566 fprintf(stderr, "libwayland: ");
567 vfprintf(stderr, fmt, args);
568}
569
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800570struct client *
571client_create(int x, int y, int width, int height)
572{
573 struct client *client;
574 struct surface *surface;
575
Pekka Paalanen07921d72012-12-12 14:26:40 +0200576 wl_log_set_handler_client(log_handler);
577
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800578 /* connect to display */
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700579 client = xzalloc(sizeof *client);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800580 client->wl_display = wl_display_connect(NULL);
581 assert(client->wl_display);
Kristian Høgsberg1cb3df42012-12-11 23:03:56 -0500582 wl_list_init(&client->global_list);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800583
584 /* setup registry so we can bind to interfaces */
585 client->wl_registry = wl_display_get_registry(client->wl_display);
586 wl_registry_add_listener(client->wl_registry, &registry_listener, client);
587
588 /* trigger global listener */
589 wl_display_dispatch(client->wl_display);
590 wl_display_roundtrip(client->wl_display);
591
592 /* must have WL_SHM_FORMAT_ARGB32 */
593 assert(client->has_argb);
594
595 /* must have wl_test interface */
596 assert(client->test);
597
598 /* must have an output */
599 assert(client->output);
600
601 /* initialize the client surface */
Kristian Høgsbergc1b244f2013-10-09 14:01:23 -0700602 surface = xzalloc(sizeof *surface);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800603 surface->wl_surface =
604 wl_compositor_create_surface(client->wl_compositor);
605 assert(surface->wl_surface);
606
607 wl_surface_add_listener(surface->wl_surface, &surface_listener,
608 surface);
609
610 client->surface = surface;
611 wl_surface_set_user_data(surface->wl_surface, surface);
612
613 surface->width = width;
614 surface->height = height;
Pekka Paalanen32ac9b92013-02-08 17:01:26 +0200615 surface->wl_buffer = create_shm_buffer(client, width, height,
616 &surface->data);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800617
618 memset(surface->data, 64, width * height * 4);
U. Artie Eoff1ba9b382012-12-07 13:50:32 -0800619
620 move_client(client, x, y);
621
622 return client;
623}