gears: Fail if compiled without cairo-egl
authorBenjamin Franzke <benjaminfranzke@googlemail.com>
Fri, 7 Oct 2011 07:33:06 +0000 (09:33 +0200)
committerBenjamin Franzke <benjaminfranzke@googlemail.com>
Fri, 7 Oct 2011 08:06:01 +0000 (10:06 +0200)
clients/gears.c
clients/window.c
clients/window.h

index a2fc0de..6af505b 100644 (file)
@@ -207,9 +207,12 @@ draw_gears(struct gears *gears)
        window_get_child_allocation(gears->window, &allocation);
        window_get_allocation(gears->window, &window_allocation);
 
-       display_acquire_window_surface(gears->d,
-                                      gears->window,
-                                      gears->context);
+       if (display_acquire_window_surface(gears->d,
+                                           gears->window,
+                                           gears->context) < 0) {
+               die("Unable to acquire window surface, "
+                   "compiled without cairo-egl?\n");
+       }
        
        glViewport(allocation.x,
                   window_allocation.height - allocation.height - allocation.x,
index 8f5da49..3bb4cb7 100644 (file)
@@ -2211,7 +2211,7 @@ display_get_shell(struct display *display)
        return display->shell;
 }
 
-void
+int
 display_acquire_window_surface(struct display *display,
                               struct window *window,
                               EGLContext ctx)
@@ -2221,10 +2221,10 @@ display_acquire_window_surface(struct display *display,
        cairo_device_t *device;
 
        if (!window->cairo_surface)
-               return;
+               return -1;
        device = cairo_surface_get_device(window->cairo_surface);
        if (!device)
-               return;
+               return -1;
 
        if (!ctx) {
                if (device == display->rgb_device)
@@ -2241,6 +2241,10 @@ display_acquire_window_surface(struct display *display,
        cairo_device_acquire(device);
        if (!eglMakeCurrent(display->dpy, data->surf, data->surf, ctx))
                fprintf(stderr, "failed to make surface current\n");
+
+       return 0;
+#else
+       return -1;
 #endif
 }
 
index 42b8b13..6a4ce9f 100644 (file)
@@ -67,7 +67,7 @@ display_get_rgb_egl_config(struct display *d);
 EGLConfig
 display_get_argb_egl_config(struct display *d);
 
-void
+int
 display_acquire_window_surface(struct display *display,
                               struct window *window,
                               EGLContext ctx);