[RFCv3 weston 03/15] compositor: refactor code into weston_surface_reset_pending_buffer()

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 7 04:03:51 PST 2014


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 src/compositor.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 2911157..e1d6df1 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1312,6 +1312,17 @@ weston_surface_unmap(struct weston_surface *surface)
 	surface->output = NULL;
 }
 
+static void
+weston_surface_reset_pending_buffer(struct weston_surface *surface)
+{
+	if (surface->pending.buffer)
+		wl_list_remove(&surface->pending.buffer_destroy_listener.link);
+	surface->pending.buffer = NULL;
+	surface->pending.sx = 0;
+	surface->pending.sy = 0;
+	surface->pending.newly_attached = 0;
+}
+
 struct weston_frame_callback {
 	struct wl_resource *resource;
 	struct wl_list link;
@@ -2021,12 +2032,7 @@ weston_surface_commit(struct weston_surface *surface)
 		surface->configure(surface,
 				   surface->pending.sx, surface->pending.sy);
 
-	if (surface->pending.buffer)
-		wl_list_remove(&surface->pending.buffer_destroy_listener.link);
-	surface->pending.buffer = NULL;
-	surface->pending.sx = 0;
-	surface->pending.sy = 0;
-	surface->pending.newly_attached = 0;
+	weston_surface_reset_pending_buffer(surface);
 
 	/* wl_surface.damage */
 	pixman_region32_union(&surface->damage, &surface->damage,
@@ -2317,12 +2323,7 @@ weston_subsurface_commit_to_cache(struct weston_subsurface *sub)
 	sub->cached.sx += surface->pending.sx;
 	sub->cached.sy += surface->pending.sy;
 
-	if (surface->pending.buffer)
-		wl_list_remove(&surface->pending.buffer_destroy_listener.link);
-	surface->pending.buffer = NULL;
-	surface->pending.sx = 0;
-	surface->pending.sy = 0;
-	surface->pending.newly_attached = 0;
+	weston_surface_reset_pending_buffer(surface);
 
 	sub->cached.buffer_viewport = surface->pending.buffer_viewport;
 
-- 
1.8.3.2



More information about the wayland-devel mailing list