[RFC weston 4/4] simple-egl: Use wl_egl_window_take_buffer

John Kåre Alsaker john.kare.alsaker at gmail.com
Sat Mar 2 17:26:14 PST 2013


---
 clients/simple-egl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index 26ebe5c..8138a02 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -365,6 +365,7 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
 	static const int32_t speed_div = 5;
 	static uint32_t start_time = 0;
 	struct wl_region *region;
+	struct wl_buffer *buffer;
 
 	assert(window->callback == callback);
 	window->callback = NULL;
@@ -416,7 +417,14 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
 	window->callback = wl_surface_frame(window->surface);
 	wl_callback_add_listener(window->callback, &frame_listener, window);
 
-	eglSwapBuffers(window->display->egl.dpy, window->egl_surface);
+	buffer = wl_egl_window_take_buffer(window->native);
+
+	wl_surface_attach(window->surface, buffer, 0, 0);
+
+	wl_surface_damage(window->surface, 0, 0,
+		     window->geometry.width, window->geometry.height);
+
+	wl_surface_commit(window->surface);
 }
 
 static const struct wl_callback_listener frame_listener = {
-- 
1.8.1.4



More information about the wayland-devel mailing list