Commit 5b2ca341 authored by Marek Chalupa's avatar Marek Chalupa Committed by Adam Jackson

xwayland: check if creating xwl_output succeeded

check return values of RR.*Create calls

v2. do not bail out if we don't have any output
Signed-off-by: default avatarMarek Chalupa <mchqwerty@gmail.com>
Reviewed-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
parent 646ebea4
......@@ -240,6 +240,11 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
&wl_output_interface, 2);
if (!xwl_output->output) {
ErrorF("Failed binding wl_output\n");
goto err;
}
xwl_output->server_output_id = id;
wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
......@@ -247,13 +252,31 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
xwl_output->xwl_screen = xwl_screen;
xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output);
if (!xwl_output->randr_crtc) {
ErrorF("Failed creating RandR CRTC\n");
goto err;
}
xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name,
strlen(name), xwl_output);
if (!xwl_output->randr_output) {
ErrorF("Failed creating RandR Output\n");
goto err;
}
RRCrtcGammaSetSize(xwl_output->randr_crtc, 256);
RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1);
RROutputSetConnection(xwl_output->randr_output, RR_Connected);
return xwl_output;
err:
if (xwl_output->randr_crtc)
RRCrtcDestroy(xwl_output->randr_crtc);
if (xwl_output->output)
wl_output_destroy(xwl_output->output);
free(xwl_output);
return NULL;
}
void
......
......@@ -421,8 +421,8 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
wl_registry_bind(registry, id, &wl_shell_interface, 1);
}
else if (strcmp(interface, "wl_output") == 0 && version >= 2) {
xwl_output_create(xwl_screen, id);
xwl_screen->expecting_event++;
if (xwl_output_create(xwl_screen, id))
xwl_screen->expecting_event++;
}
#ifdef GLAMOR_HAS_GBM
else if (xwl_screen->glamor &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment