summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorPekka Paalanen <ppaalanen@gmail.com>2012-11-19 17:16:00 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-11-27 15:50:26 -0500
commitb362736bb20056d6eece0cffc50e8496d02aaffa (patch)
tree2bc1f549b49289a534a2e6ca7912d084e7aaf642 /clients
parent9943686be359a6e1dc982bb44dd9dde9bb21e7a2 (diff)
window: simplify window_create_surface
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Diffstat (limited to 'clients')
-rw-r--r--clients/window.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/clients/window.c b/clients/window.c
index adcca76..7f8a335 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -494,6 +494,9 @@ egl_window_surface_create(struct display *display,
{
struct egl_window_surface *surface;
+ if (display->dpy == EGL_NO_DISPLAY)
+ return NULL;
+
surface = calloc(1, sizeof *surface);
if (!surface)
return NULL;
@@ -525,6 +528,17 @@ egl_window_surface_create(struct display *display,
return &surface->base;
}
+#else
+
+static struct toysurface *
+egl_window_surface_create(struct display *display,
+ struct wl_surface *wl_surface,
+ uint32_t flags,
+ struct rectangle *rectangle)
+{
+ return NULL;
+}
+
#endif
struct shm_surface_data {
@@ -1130,28 +1144,19 @@ window_create_surface(struct window *window)
if (!window->transparent)
flags = SURFACE_OPAQUE;
- switch (window->buffer_type) {
-#ifdef HAVE_CAIRO_EGL
- case WINDOW_BUFFER_TYPE_EGL_WINDOW:
- if (!window->toysurface && window->display->dpy)
- window->toysurface =
- egl_window_surface_create(window->display,
- window->surface,
- flags,
- &window->allocation);
-
- if (window->toysurface)
- break;
- /* fall through */
-#endif
- case WINDOW_BUFFER_TYPE_SHM:
+ if (!window->toysurface &&
+ window->buffer_type == WINDOW_BUFFER_TYPE_EGL_WINDOW &&
+ window->display->dpy) {
+ window->toysurface =
+ egl_window_surface_create(window->display,
+ window->surface, flags,
+ &window->allocation);
+ }
+
+ if (!window->toysurface)
window->toysurface = shm_surface_create(window->display,
window->surface, flags,
&window->allocation);
- break;
- default:
- assert(0);
- }
window_get_resize_dx_dy(window, &dx, &dy);
window->cairo_surface =