window: Add API to check for subcompositor, use in subsurface example

This way we can fail with a nice error message.
dev
Kristian Høgsberg 11 years ago
parent c85a9178c7
commit b20b00923a
  1. 6
      clients/subsurfaces.c
  2. 11
      clients/window.c
  3. 3
      clients/window.h

@ -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);

Loading…
Cancel
Save