gears: Use wayland egl surface instead of images
diff --git a/clients/window.c b/clients/window.c
index 4792710..6e7ef9b 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -870,7 +870,10 @@
 
 	cairo_destroy(cr);
 
+	/* FIXME: this breakes gears, fix cairo? */
+#if 0 
 	cairo_device_flush (window->display->device);
+#endif
 }
 
 void
@@ -1261,6 +1264,13 @@
 };
 
 void
+window_get_allocation(struct window *window,
+		      struct rectangle *allocation)
+{
+	*allocation = window->allocation;
+}
+
+void
 window_get_child_allocation(struct window *window,
 			    struct rectangle *allocation)
 {
@@ -1850,6 +1860,12 @@
 	return d->dpy;
 }
 
+EGLConfig
+display_get_egl_config(struct display *d)
+{
+	return d->conf;
+}
+
 struct wl_shell *
 display_get_shell(struct display *display)
 {
@@ -1857,6 +1873,35 @@
 }
 
 void
+display_acquire_window_surface(struct display *display,
+			       struct window *window,
+			       EGLContext ctx)
+{
+	struct egl_window_surface_data *data;
+
+	if (!window->cairo_surface)
+		return;
+
+	if (!ctx)
+		ctx = display->ctx;
+
+	data = cairo_surface_get_user_data(window->cairo_surface,
+					   &surface_data_key);
+
+	cairo_device_acquire(display->device);
+	if (!eglMakeCurrent(display->dpy, data->surf, data->surf, ctx))
+		fprintf(stderr, "failed to make surface current\n");
+}
+
+void
+display_release(struct display *display)
+{
+	if (!eglMakeCurrent(display->dpy, NULL, NULL, display->ctx))
+		fprintf(stderr, "failed to make context current\n");
+	cairo_device_release(display->device);
+}
+
+void
 display_run(struct display *d)
 {
 	g_main_loop_run(d->loop);