[PATCH weston 02/12] clients: use wl_surface_commit

Pekka Paalanen ppaalanen at gmail.com
Wed Oct 10 02:49:24 PDT 2012


Use wl_surface_commit() to commit the buffer attach, as Weston now
requires.

NOTE: GL-applications are broken until you upgrade to a version of Mesa
which does wl_surface_commit() on eglSwapBuffers(). If you have
Cairo-gl, this means all toytoolkit apps, too.

simple-shm and simple-touch OTOH will work now.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 clients/dnd.c          |    2 ++
 clients/simple-shm.c   |    1 +
 clients/simple-touch.c |    1 +
 clients/window.c       |    2 ++
 4 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/clients/dnd.c b/clients/dnd.c
index 44c1541..4c070ff 100644
--- a/clients/dnd.c
+++ b/clients/dnd.c
@@ -269,6 +269,7 @@ data_source_target(void *data,
 	wl_surface_attach(dnd_drag->drag_surface, buffer, 0, 0);
 	wl_surface_damage(dnd_drag->drag_surface, 0, 0,
 			  dnd_drag->width, dnd_drag->height);
+	wl_surface_commit(dnd_drag->drag_surface);
 }
 
 static void
@@ -450,6 +451,7 @@ dnd_button_handler(struct widget *widget,
 				  -dnd_drag->hotspot_x, -dnd_drag->hotspot_y);
 		wl_surface_damage(dnd_drag->drag_surface, 0, 0,
 				  dnd_drag->width, dnd_drag->height);
+		wl_surface_commit(dnd_drag->drag_surface);
 
 		dnd->current_drag = dnd_drag;
 		window_schedule_redraw(dnd->window);
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index f62e54e..c4daadd 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -217,6 +217,7 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
 	paint_pixels(window->shm_data, 20, window->width, window->height, time);
 	wl_surface_damage(window->surface,
 			  20, 20, window->width - 40, window->height - 40);
+	wl_surface_commit(window->surface);
 
 	if (callback)
 		wl_callback_destroy(callback);
diff --git a/clients/simple-touch.c b/clients/simple-touch.c
index 03fd45b..77f3b0f 100644
--- a/clients/simple-touch.c
+++ b/clients/simple-touch.c
@@ -306,6 +306,7 @@ touch_create(int width, int height)
 	memset(touch->data, 64, width * height * 4);
 	wl_surface_attach(touch->surface, touch->buffer, 0, 0);
 	wl_surface_damage(touch->surface, 0, 0, width, height);
+	wl_surface_commit(touch->surface);
 
 	return touch;
 }
diff --git a/clients/window.c b/clients/window.c
index aba1254..24bd0c4 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -841,6 +841,7 @@ window_attach_surface(struct window *window)
 		wl_surface_damage(window->surface, 0, 0,
 				  window->allocation.width,
 				  window->allocation.height);
+		wl_surface_commit(window->surface);
 		window->server_allocation = window->allocation;
 		cairo_surface_destroy(window->cairo_surface);
 		window->cairo_surface = NULL;
@@ -2587,6 +2588,7 @@ input_set_pointer_image_index(struct input *input, int index)
 	wl_surface_attach(input->pointer_surface, buffer, 0, 0);
 	wl_surface_damage(input->pointer_surface, 0, 0,
 			  image->width, image->height);
+	wl_surface_commit(input->pointer_surface);
 }
 
 static const struct wl_callback_listener pointer_surface_listener;
-- 
1.7.8.6



More information about the wayland-devel mailing list