blob: df9a13918608b02d1b9a09cf4aa5ed53e6174679 [file] [log] [blame]
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -08001/*
2 * Copyright © 2012 Intel Corporation
3 *
Bryce Harrington2cc92972015-06-11 15:39:40 -07004 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080011 *
Bryce Harrington2cc92972015-06-11 15:39:40 -070012 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080024 */
25
Neil Roberts40c0c3f2013-10-29 20:13:45 +000026#include "config.h"
27
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080028#include <stdlib.h>
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080029#include <assert.h>
30#include <signal.h>
31#include <unistd.h>
Marek Chalupac8daf772015-03-30 06:37:55 -040032#include <string.h>
Bryce Harringtona7680262014-11-19 17:18:34 -080033
Jon Cruz4678bab2015-06-15 15:37:07 -070034#include "src/compositor.h"
Derek Foremanf6a65922015-02-24 09:32:14 -060035#include "weston-test-server-protocol.h"
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080036
Neil Roberts40c0c3f2013-10-29 20:13:45 +000037#ifdef ENABLE_EGL
38#include <EGL/egl.h>
39#include <EGL/eglext.h>
Jon Cruz4678bab2015-06-15 15:37:07 -070040#include "src/weston-egl-ext.h"
Neil Roberts40c0c3f2013-10-29 20:13:45 +000041#endif /* ENABLE_EGL */
42
Jon Cruz867d50e2015-06-15 15:37:10 -070043#include "shared/helpers.h"
44
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080045struct weston_test {
46 struct weston_compositor *compositor;
47 struct weston_layer layer;
48 struct weston_process process;
Marek Chalupac3c3fc42015-03-30 09:17:40 -040049 struct weston_seat seat;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080050};
51
52struct weston_test_surface {
53 struct weston_surface *surface;
Jason Ekstranda7af7042013-10-12 22:38:11 -050054 struct weston_view *view;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080055 int32_t x, y;
56 struct weston_test *test;
57};
58
59static void
60test_client_sigchld(struct weston_process *process, int status)
61{
62 struct weston_test *test =
63 container_of(process, struct weston_test, process);
64
Emilio Pozuelo Monfortdae8a4b2014-02-07 09:34:48 +010065 /* Chain up from weston-test-runner's exit code so that automake
66 * knows the exit status and can report e.g. skipped tests. */
67 if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
68 exit(WEXITSTATUS(status));
69
70 /* In case the child aborted or segfaulted... */
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080071 assert(status == 0);
72
73 wl_display_terminate(test->compositor->wl_display);
74}
75
76static struct weston_seat *
77get_seat(struct weston_test *test)
78{
Marek Chalupac3c3fc42015-03-30 09:17:40 -040079 return &test->seat;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080080}
81
82static void
83notify_pointer_position(struct weston_test *test, struct wl_resource *resource)
84{
85 struct weston_seat *seat = get_seat(test);
Kristian Høgsberge3148752013-05-06 23:19:49 -040086 struct weston_pointer *pointer = seat->pointer;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080087
Derek Foremanf6a65922015-02-24 09:32:14 -060088 weston_test_send_pointer_position(resource, pointer->x, pointer->y);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080089}
90
91static void
Jason Ekstrand918f2dd2013-12-02 21:01:53 -060092test_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080093{
Giulio Camuffo7fe01b12013-03-28 18:02:42 +010094 struct weston_test_surface *test_surface = surface->configure_private;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -080095 struct weston_test *test = test_surface->test;
96
Giulio Camuffo412e6a52014-07-09 22:12:56 +030097 if (wl_list_empty(&test_surface->view->layer_link.link))
98 weston_layer_entry_insert(&test->layer.view_list,
99 &test_surface->view->layer_link);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800100
Jason Ekstrand918f2dd2013-12-02 21:01:53 -0600101 weston_view_set_position(test_surface->view,
102 test_surface->x, test_surface->y);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800103
Kristian Høgsbergace0a392013-11-13 21:55:57 -0800104 weston_view_update_transform(test_surface->view);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800105}
106
107static void
108move_surface(struct wl_client *client, struct wl_resource *resource,
109 struct wl_resource *surface_resource,
110 int32_t x, int32_t y)
111{
Kristian Høgsberg8f7f4832013-06-25 16:18:35 -0400112 struct weston_surface *surface =
113 wl_resource_get_user_data(surface_resource);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800114 struct weston_test_surface *test_surface;
115
Giulio Camuffo7fe01b12013-03-28 18:02:42 +0100116 test_surface = surface->configure_private;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500117 if (!test_surface) {
118 test_surface = malloc(sizeof *test_surface);
119 if (!test_surface) {
120 wl_resource_post_no_memory(resource);
121 return;
122 }
123
124 test_surface->view = weston_view_create(surface);
125 if (!test_surface->view) {
126 wl_resource_post_no_memory(resource);
127 free(test_surface);
128 return;
129 }
130
131 surface->configure_private = test_surface;
132 surface->configure = test_surface_configure;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800133 }
134
135 test_surface->surface = surface;
Kristian Høgsberg8f7f4832013-06-25 16:18:35 -0400136 test_surface->test = wl_resource_get_user_data(resource);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800137 test_surface->x = x;
138 test_surface->y = y;
139}
140
141static void
142move_pointer(struct wl_client *client, struct wl_resource *resource,
143 int32_t x, int32_t y)
144{
Kristian Høgsberg8f7f4832013-06-25 16:18:35 -0400145 struct weston_test *test = wl_resource_get_user_data(resource);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800146 struct weston_seat *seat = get_seat(test);
Kristian Høgsberge3148752013-05-06 23:19:49 -0400147 struct weston_pointer *pointer = seat->pointer;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800148
Kristian Høgsberg068b61c2013-02-25 17:04:47 -0500149 notify_motion(seat, 100,
150 wl_fixed_from_int(x) - pointer->x,
151 wl_fixed_from_int(y) - pointer->y);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800152
153 notify_pointer_position(test, resource);
154}
155
156static void
157send_button(struct wl_client *client, struct wl_resource *resource,
158 int32_t button, uint32_t state)
159{
Kristian Høgsberg8f7f4832013-06-25 16:18:35 -0400160 struct weston_test *test = wl_resource_get_user_data(resource);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800161 struct weston_seat *seat = get_seat(test);
162
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800163 notify_button(seat, 100, button, state);
164}
165
166static void
167activate_surface(struct wl_client *client, struct wl_resource *resource,
168 struct wl_resource *surface_resource)
169{
170 struct weston_surface *surface = surface_resource ?
Kristian Høgsberg8f7f4832013-06-25 16:18:35 -0400171 wl_resource_get_user_data(surface_resource) : NULL;
172 struct weston_test *test = wl_resource_get_user_data(resource);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800173 struct weston_seat *seat;
174
175 seat = get_seat(test);
176
177 if (surface) {
178 weston_surface_activate(surface, seat);
Kristian Høgsberge3148752013-05-06 23:19:49 -0400179 notify_keyboard_focus_in(seat, &seat->keyboard->keys,
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800180 STATE_UPDATE_AUTOMATIC);
181 }
182 else {
183 notify_keyboard_focus_out(seat);
184 weston_surface_activate(surface, seat);
185 }
186}
187
188static void
189send_key(struct wl_client *client, struct wl_resource *resource,
190 uint32_t key, enum wl_keyboard_key_state state)
191{
Kristian Høgsberg8f7f4832013-06-25 16:18:35 -0400192 struct weston_test *test = wl_resource_get_user_data(resource);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800193 struct weston_seat *seat = get_seat(test);
194
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800195 notify_key(seat, 100, key, state, STATE_UPDATE_AUTOMATIC);
196}
197
Marek Chalupac8daf772015-03-30 06:37:55 -0400198static void
199device_release(struct wl_client *client,
200 struct wl_resource *resource, const char *device)
201{
202 struct weston_test *test = wl_resource_get_user_data(resource);
203 struct weston_seat *seat = get_seat(test);
204
205 if (strcmp(device, "pointer") == 0) {
206 weston_seat_release_pointer(seat);
207 } else if (strcmp(device, "keyboard") == 0) {
208 weston_seat_release_keyboard(seat);
209 } else if (strcmp(device, "touch") == 0) {
210 weston_seat_release_touch(seat);
211 } else if (strcmp(device, "seat") == 0) {
212 weston_seat_release(seat);
213 } else {
214 assert(0 && "Unsupported device");
215 }
216}
217
218static void
219device_add(struct wl_client *client,
220 struct wl_resource *resource, const char *device)
221{
222 struct weston_test *test = wl_resource_get_user_data(resource);
223 struct weston_seat *seat = get_seat(test);
224
225 if (strcmp(device, "pointer") == 0) {
226 weston_seat_init_pointer(seat);
227 } else if (strcmp(device, "keyboard") == 0) {
228 weston_seat_init_keyboard(seat, NULL);
229 } else if (strcmp(device, "touch") == 0) {
230 weston_seat_init_touch(seat);
231 } else {
232 assert(0 && "Unsupported device");
233 }
234}
235
Neil Roberts40c0c3f2013-10-29 20:13:45 +0000236#ifdef ENABLE_EGL
237static int
238is_egl_buffer(struct wl_resource *resource)
239{
240 PFNEGLQUERYWAYLANDBUFFERWL query_buffer =
241 (void *) eglGetProcAddress("eglQueryWaylandBufferWL");
242 EGLint format;
243
244 if (query_buffer(eglGetCurrentDisplay(),
245 resource,
246 EGL_TEXTURE_FORMAT,
247 &format))
248 return 1;
249
250 return 0;
251}
252#endif /* ENABLE_EGL */
253
254static void
255get_n_buffers(struct wl_client *client, struct wl_resource *resource)
256{
257 int n_buffers = 0;
258
259#ifdef ENABLE_EGL
260 struct wl_resource *buffer_resource;
261 int i;
262
263 for (i = 0; i < 1000; i++) {
264 buffer_resource = wl_client_get_object(client, i);
265
266 if (buffer_resource == NULL)
267 continue;
268
269 if (is_egl_buffer(buffer_resource))
270 n_buffers++;
271 }
272#endif /* ENABLE_EGL */
273
Derek Foremanf6a65922015-02-24 09:32:14 -0600274 weston_test_send_n_egl_buffers(resource, n_buffers);
Neil Roberts40c0c3f2013-10-29 20:13:45 +0000275}
276
Bryce Harringtonf280d112015-05-05 15:13:20 -0700277enum weston_test_screenshot_outcome {
278 WESTON_TEST_SCREENSHOT_SUCCESS,
279 WESTON_TEST_SCREENSHOT_NO_MEMORY,
280 WESTON_TEST_SCREENSHOT_BAD_BUFFER
281 };
282
283typedef void (*weston_test_screenshot_done_func_t)(void *data,
284 enum weston_test_screenshot_outcome outcome);
285
286struct test_screenshot {
287 struct weston_compositor *compositor;
288 struct wl_global *global;
289 struct wl_client *client;
290 struct weston_process process;
291 struct wl_listener destroy_listener;
292};
293
294struct test_screenshot_frame_listener {
295 struct wl_listener listener;
296 struct weston_buffer *buffer;
297 weston_test_screenshot_done_func_t done;
298 void *data;
299};
300
301static void
302copy_bgra_yflip(uint8_t *dst, uint8_t *src, int height, int stride)
303{
304 uint8_t *end;
305
306 end = dst + height * stride;
307 while (dst < end) {
308 memcpy(dst, src, stride);
309 dst += stride;
310 src -= stride;
311 }
312}
313
314
315static void
316copy_bgra(uint8_t *dst, uint8_t *src, int height, int stride)
317{
318 /* TODO: optimize this out */
319 memcpy(dst, src, height * stride);
320}
321
322static void
323copy_row_swap_RB(void *vdst, void *vsrc, int bytes)
324{
325 uint32_t *dst = vdst;
326 uint32_t *src = vsrc;
327 uint32_t *end = dst + bytes / 4;
328
329 while (dst < end) {
330 uint32_t v = *src++;
331 /* A R G B */
332 uint32_t tmp = v & 0xff00ff00;
333 tmp |= (v >> 16) & 0x000000ff;
334 tmp |= (v << 16) & 0x00ff0000;
335 *dst++ = tmp;
336 }
337}
338
339static void
340copy_rgba_yflip(uint8_t *dst, uint8_t *src, int height, int stride)
341{
342 uint8_t *end;
343
344 end = dst + height * stride;
345 while (dst < end) {
346 copy_row_swap_RB(dst, src, stride);
347 dst += stride;
348 src -= stride;
349 }
350}
351
352static void
353copy_rgba(uint8_t *dst, uint8_t *src, int height, int stride)
354{
355 uint8_t *end;
356
357 end = dst + height * stride;
358 while (dst < end) {
359 copy_row_swap_RB(dst, src, stride);
360 dst += stride;
361 src += stride;
362 }
363}
364
365static void
366test_screenshot_frame_notify(struct wl_listener *listener, void *data)
367{
368 struct test_screenshot_frame_listener *l =
369 container_of(listener,
370 struct test_screenshot_frame_listener, listener);
371 struct weston_output *output = data;
372 struct weston_compositor *compositor = output->compositor;
373 int32_t stride;
374 uint8_t *pixels, *d, *s;
375
376 output->disable_planes--;
377 wl_list_remove(&listener->link);
378 stride = l->buffer->width * (PIXMAN_FORMAT_BPP(compositor->read_format) / 8);
379 pixels = malloc(stride * l->buffer->height);
380
381 if (pixels == NULL) {
382 l->done(l->data, WESTON_TEST_SCREENSHOT_NO_MEMORY);
383 free(l);
384 return;
385 }
386
387 // FIXME: Needs to handle output transformations
388
389 compositor->renderer->read_pixels(output,
390 compositor->read_format,
391 pixels,
392 0, 0,
393 output->current_mode->width,
394 output->current_mode->height);
395
396 stride = wl_shm_buffer_get_stride(l->buffer->shm_buffer);
397
398 d = wl_shm_buffer_get_data(l->buffer->shm_buffer);
399 s = pixels + stride * (l->buffer->height - 1);
400
401 wl_shm_buffer_begin_access(l->buffer->shm_buffer);
402
403 /* XXX: It would be nice if we used Pixman to do all this rather
404 * than our own implementation
405 */
406 switch (compositor->read_format) {
407 case PIXMAN_a8r8g8b8:
408 case PIXMAN_x8r8g8b8:
409 if (compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP)
410 copy_bgra_yflip(d, s, output->current_mode->height, stride);
411 else
412 copy_bgra(d, pixels, output->current_mode->height, stride);
413 break;
414 case PIXMAN_x8b8g8r8:
415 case PIXMAN_a8b8g8r8:
416 if (compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP)
417 copy_rgba_yflip(d, s, output->current_mode->height, stride);
418 else
419 copy_rgba(d, pixels, output->current_mode->height, stride);
420 break;
421 default:
422 break;
423 }
424
425 wl_shm_buffer_end_access(l->buffer->shm_buffer);
426
427 l->done(l->data, WESTON_TEST_SCREENSHOT_SUCCESS);
428 free(pixels);
429 free(l);
430}
431
432static bool
433weston_test_screenshot_shoot(struct weston_output *output,
434 struct weston_buffer *buffer,
435 weston_test_screenshot_done_func_t done,
436 void *data)
437{
438 struct test_screenshot_frame_listener *l;
439
440 /* Get the shm buffer resource the client created */
441 if (!wl_shm_buffer_get(buffer->resource)) {
442 done(data, WESTON_TEST_SCREENSHOT_BAD_BUFFER);
443 return false;
444 }
445
446 buffer->shm_buffer = wl_shm_buffer_get(buffer->resource);
447 buffer->width = wl_shm_buffer_get_width(buffer->shm_buffer);
448 buffer->height = wl_shm_buffer_get_height(buffer->shm_buffer);
449
450 /* Verify buffer is big enough */
451 if (buffer->width < output->current_mode->width ||
452 buffer->height < output->current_mode->height) {
453 done(data, WESTON_TEST_SCREENSHOT_BAD_BUFFER);
454 return false;
455 }
456
457 /* allocate the frame listener */
458 l = malloc(sizeof *l);
459 if (l == NULL) {
460 done(data, WESTON_TEST_SCREENSHOT_NO_MEMORY);
461 return false;
462 }
463
464 /* Set up the listener */
465 l->buffer = buffer;
466 l->done = done;
467 l->data = data;
468 l->listener.notify = test_screenshot_frame_notify;
469 wl_signal_add(&output->frame_signal, &l->listener);
470
471 /* Fire off a repaint */
472 output->disable_planes++;
473 weston_output_schedule_repaint(output);
474
475 return true;
476}
477
478static void
479capture_screenshot_done(void *data, enum weston_test_screenshot_outcome outcome)
480{
481 struct wl_resource *resource = data;
482
483 switch (outcome) {
484 case WESTON_TEST_SCREENSHOT_SUCCESS:
485 weston_test_send_capture_screenshot_done(resource);
486 break;
487 case WESTON_TEST_SCREENSHOT_NO_MEMORY:
488 wl_resource_post_no_memory(resource);
489 break;
490 default:
491 break;
492 }
493}
494
495
496/**
497 * Grabs a snapshot of the screen.
498 */
499static void
500capture_screenshot(struct wl_client *client,
501 struct wl_resource *resource,
502 struct wl_resource *output_resource,
503 struct wl_resource *buffer_resource)
504{
505 struct weston_output *output =
506 wl_resource_get_user_data(output_resource);
507 struct weston_buffer *buffer =
508 weston_buffer_from_resource(buffer_resource);
509
510 if (buffer == NULL) {
511 wl_resource_post_no_memory(resource);
512 return;
513 }
514
515 weston_test_screenshot_shoot(output, buffer,
516 capture_screenshot_done, resource);
517}
518
Derek Foremanf6a65922015-02-24 09:32:14 -0600519static const struct weston_test_interface test_implementation = {
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800520 move_surface,
521 move_pointer,
522 send_button,
523 activate_surface,
Neil Roberts40c0c3f2013-10-29 20:13:45 +0000524 send_key,
Marek Chalupac8daf772015-03-30 06:37:55 -0400525 device_release,
526 device_add,
Neil Roberts40c0c3f2013-10-29 20:13:45 +0000527 get_n_buffers,
Bryce Harringtonf280d112015-05-05 15:13:20 -0700528 capture_screenshot,
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800529};
530
531static void
532bind_test(struct wl_client *client, void *data, uint32_t version, uint32_t id)
533{
534 struct weston_test *test = data;
535 struct wl_resource *resource;
536
Derek Foremanf6a65922015-02-24 09:32:14 -0600537 resource = wl_resource_create(client, &weston_test_interface, 1, id);
Marek Chalupa42ebdda2014-07-11 12:33:02 +0200538 if (!resource) {
539 wl_client_post_no_memory(client);
540 return;
541 }
542
Kristian Høgsberg442a5fa2013-07-03 18:13:33 -0400543 wl_resource_set_implementation(resource,
544 &test_implementation, test, NULL);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800545
546 notify_pointer_position(test, resource);
547}
548
549static void
550idle_launch_client(void *data)
551{
552 struct weston_test *test = data;
553 pid_t pid;
554 sigset_t allsigs;
555 char *path;
556
557 path = getenv("WESTON_TEST_CLIENT_PATH");
558 if (path == NULL)
Pekka Paalanenf72e4792013-11-21 16:23:57 +0200559 return;
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800560 pid = fork();
561 if (pid == -1)
562 exit(EXIT_FAILURE);
563 if (pid == 0) {
564 sigfillset(&allsigs);
565 sigprocmask(SIG_UNBLOCK, &allsigs, NULL);
566 execl(path, path, NULL);
567 weston_log("compositor: executing '%s' failed: %m\n", path);
568 exit(EXIT_FAILURE);
569 }
570
571 test->process.pid = pid;
572 test->process.cleanup = test_client_sigchld;
573 weston_watch_process(&test->process);
574}
575
576WL_EXPORT int
Kristian Høgsbergcb4685b2013-02-20 15:37:49 -0500577module_init(struct weston_compositor *ec,
Ossama Othmana50e6e42013-05-14 09:48:26 -0700578 int *argc, char *argv[])
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800579{
580 struct weston_test *test;
581 struct wl_event_loop *loop;
582
Peter Huttererf3d62272013-08-08 11:57:05 +1000583 test = zalloc(sizeof *test);
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800584 if (test == NULL)
585 return -1;
586
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800587 test->compositor = ec;
588 weston_layer_init(&test->layer, &ec->cursor_layer.link);
589
Derek Foremanf6a65922015-02-24 09:32:14 -0600590 if (wl_global_create(ec->wl_display, &weston_test_interface, 1,
Kristian Høgsberg919cddb2013-07-08 19:03:57 -0400591 test, bind_test) == NULL)
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800592 return -1;
593
Marek Chalupac3c3fc42015-03-30 09:17:40 -0400594 /* create our own seat */
595 weston_seat_init(&test->seat, ec, "test-seat");
596
597 /* add devices */
598 weston_seat_init_pointer(&test->seat);
599 weston_seat_init_keyboard(&test->seat, NULL);
600 weston_seat_init_touch(&test->seat);
601
U. Artie Eoff65e7e7a2012-12-07 13:50:29 -0800602 loop = wl_display_get_event_loop(ec->wl_display);
603 wl_event_loop_add_idle(loop, idle_launch_client, test);
604
605 return 0;
606}