From: Kristian Høgsberg Date: Thu, 15 Aug 2013 18:54:03 +0000 (-0700) Subject: window: Add API to check for subcompositor, use in subsurface example X-Git-Tag: 1.2.91~118 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b20b00923a588dfa3d89ba44a0370b333199740f;p=platform%2Fupstream%2Fweston.git window: Add API to check for subcompositor, use in subsurface example This way we can fail with a nice error message. --- diff --git a/clients/subsurfaces.c b/clients/subsurfaces.c index f93057e..51b07a2 100644 --- a/clients/subsurfaces.c +++ b/clients/subsurfaces.c @@ -781,6 +781,12 @@ main(int argc, char *argv[]) return -1; } + if (!display_has_subcompositor(display)) { + fprintf(stderr, "compositor does not support " + "the subcompositor extension\n"); + return -1; + } + app = demoapp_create(display); display_run(display); diff --git a/clients/window.c b/clients/window.c index 3410354..7223e37 100644 --- a/clients/window.c +++ b/clients/window.c @@ -5367,6 +5367,17 @@ display_get_display(struct 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 * display_get_cairo_device(struct display *display) { diff --git a/clients/window.h b/clients/window.h index a817734..1646d5a 100644 --- a/clients/window.h +++ b/clients/window.h @@ -78,6 +78,9 @@ display_get_user_data(struct display *display); struct wl_display * display_get_display(struct display *display); +int +display_has_subcompositor(struct display *display); + cairo_device_t * display_get_cairo_device(struct display *display);