Skip to content
Commits on Source (6)
......@@ -548,12 +548,8 @@ vnc_new_client(struct nvnc_client *client)
peer = xzalloc(sizeof(*peer));
peer->client = client;
peer->backend = backend;
peer->seat = zalloc(sizeof(*peer->seat));
peer->seat = xzalloc(sizeof(*peer->seat));
if (!peer->seat) {
weston_log("unable to create a weston_seat\n");
return;
}
weston_seat_init(peer->seat, backend->compositor, seat_name);
weston_seat_init_pointer(peer->seat);
weston_seat_init_keyboard(peer->seat, backend->xkb_keymap);
......@@ -724,23 +720,21 @@ vnc_destroy(struct weston_compositor *ec)
free(backend);
}
static int
static void
vnc_head_create(struct weston_compositor *compositor, const char *name)
{
struct vnc_head *head;
head = zalloc(sizeof *head);
if (!head)
return -1;
head = xzalloc(sizeof *head);
weston_head_init(&head->base, name);
weston_head_set_monitor_strings(&head->base, "weston", "vnc", NULL);
weston_head_set_physical_size(&head->base, 0, 0);
head->base.backend_id = vnc_head_destroy;
weston_head_set_connection_status(&head->base, true);
weston_compositor_add_head(compositor, &head->base);
return 0;
}
static void
......@@ -824,9 +818,7 @@ vnc_insert_new_mode(struct weston_output *output, int width, int height,
{
struct weston_mode *mode;
mode = zalloc(sizeof *mode);
if (!mode)
return NULL;
mode = xzalloc(sizeof *mode);
mode->width = width;
mode->height = height;
mode->refresh = rate;
......@@ -862,11 +854,6 @@ vnc_switch_mode(struct weston_output *base, struct weston_mode *target_mode)
assert(output);
local_mode = vnc_ensure_matching_mode(base, target_mode);
if (!local_mode) {
weston_log("mode %dx%d not available\n",
target_mode->width, target_mode->height);
return -ENOENT;
}
if (local_mode == base->current_mode)
return 0;
......@@ -896,29 +883,20 @@ vnc_output_set_size(struct weston_output *base, int width, int height)
{
struct vnc_output *output = to_vnc_output(base);
struct vnc_backend *backend = to_vnc_backend(base->compositor);
struct weston_head *head;
struct weston_mode *current_mode;
struct weston_mode init_mode;
/* We can only be called once. */
assert(!output->base.current_mode);
wl_list_for_each(head, &output->base.head_list, output_link) {
weston_head_set_monitor_strings(head, "weston", "vnc", NULL);
weston_head_set_physical_size(head, 0, 0);
}
wl_list_init(&output->peers);
init_mode.flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
init_mode.width = width;
init_mode.height = height;
init_mode.refresh = backend->vnc_monitor_refresh_rate;
current_mode = vnc_ensure_matching_mode(&output->base, &init_mode);
if (!current_mode)
return -1;
current_mode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
output->base.current_mode = output->base.native_mode = current_mode;
......@@ -974,8 +952,7 @@ vnc_backend_create(struct weston_compositor *compositor,
if (pixman_renderer_init(compositor) < 0)
goto err_compositor;
if (vnc_head_create(compositor, "vnc") < 0)
goto err_compositor;
vnc_head_create(compositor, "vnc");
compositor->capabilities |= WESTON_CAP_ARBITRARY_MODES;
......@@ -1049,8 +1026,6 @@ vnc_backend_create(struct weston_compositor *compositor,
return backend;
err_output:
if (backend->output)
weston_output_release(&backend->output->base);
wl_list_for_each_safe(base, next, &compositor->head_list, compositor_link)
vnc_head_destroy(base);
err_compositor:
......