static int headless_input_create(struct headless_backend *b) { weston_seat_init(&b->fake_seat, b->compositor, "default"); weston_seat_init_pointer(&b->fake_seat); if (weston_seat_init_keyboard(&b->fake_seat, NULL) < 0) return -1; return 0; }
static int headless_input_create(struct headless_compositor *c) { weston_seat_init(&c->fake_seat, &c->base, "default"); weston_seat_init_pointer(&c->fake_seat); if (weston_seat_init_keyboard(&c->fake_seat, NULL) < 0) return -1; return 0; }
static void display_add_seat(struct wayland_compositor *c, uint32_t id) { struct wayland_input *input; input = zalloc(sizeof *input); if (input == NULL) return; weston_seat_init(&input->base, &c->base, "default"); input->compositor = c; input->seat = wl_registry_bind(c->parent.registry, id, &wl_seat_interface, 1); wl_list_insert(c->input_list.prev, &input->link); wl_seat_add_listener(input->seat, &seat_listener, input); wl_seat_set_user_data(input->seat, input); }
static struct ss_seat * ss_seat_create(struct shared_output *so, uint32_t id) { struct ss_seat *seat; seat = zalloc(sizeof *seat); if (seat == NULL) return NULL; weston_seat_init(&seat->base, so->output->compositor, "default"); seat->output = so; seat->parent.seat = wl_registry_bind(so->parent.registry, id, &wl_seat_interface, 1); wl_list_insert(so->seat_list.prev, &seat->link); wl_seat_add_listener(seat->parent.seat, &ss_seat_listener, seat); wl_seat_set_user_data(seat->parent.seat, seat); return seat; }
static struct weston_compositor * headless_compositor_create(struct wl_display *display, int width, int height, const char *display_name, int argc, char *argv[], const char *config_file) { struct headless_compositor *c; c = calloc(1, sizeof *c); if (c == NULL) return NULL; memset(c, 0, sizeof *c); if (weston_compositor_init(&c->base, display, argc, argv, config_file) < 0) goto err_free; weston_seat_init(&c->fake_seat, &c->base); c->base.destroy = headless_destroy; c->base.restore = headless_restore; if (headless_compositor_create_output(c, width, height) < 0) goto err_compositor; if (noop_renderer_init(&c->base) < 0) goto err_compositor; return &c->base; err_compositor: weston_compositor_shutdown(&c->base); err_free: free(c); return NULL; }