window: Add API to check for subcompositor, use in subsurface example
This way we can fail with a nice error message.
This commit is contained in:
@@ -781,6 +781,12 @@ main(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!display_has_subcompositor(display)) {
|
||||||
|
fprintf(stderr, "compositor does not support "
|
||||||
|
"the subcompositor extension\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
app = demoapp_create(display);
|
app = demoapp_create(display);
|
||||||
|
|
||||||
display_run(display);
|
display_run(display);
|
||||||
|
|||||||
@@ -5367,6 +5367,17 @@ display_get_display(struct display *display)
|
|||||||
return display->display;
|
return display->display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
display_has_subcompositor(struct display *display)
|
||||||
|
{
|
||||||
|
if (display->subcompositor)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
wl_display_roundtrip(display->display);
|
||||||
|
|
||||||
|
return display->subcompositor != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cairo_device_t *
|
cairo_device_t *
|
||||||
display_get_cairo_device(struct display *display)
|
display_get_cairo_device(struct display *display)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ display_get_user_data(struct display *display);
|
|||||||
struct wl_display *
|
struct wl_display *
|
||||||
display_get_display(struct display *display);
|
display_get_display(struct display *display);
|
||||||
|
|
||||||
|
int
|
||||||
|
display_has_subcompositor(struct display *display);
|
||||||
|
|
||||||
cairo_device_t *
|
cairo_device_t *
|
||||||
display_get_cairo_device(struct display *display);
|
display_get_cairo_device(struct display *display);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user