libweston-desktop: Drop (wrongly named) new_buffer in committed

Instead we store the buffer move and just use it when the signal is
fired.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c
index bdf6dbc..42258db 100644
--- a/libweston-desktop/surface.c
+++ b/libweston-desktop/surface.c
@@ -51,7 +51,7 @@
 	void *user_data;
 	struct weston_surface *surface;
 	struct wl_list view_list;
-	bool has_new_buffer;
+	struct weston_position buffer_move;
 	struct wl_listener surface_commit_listener;
 	struct wl_listener surface_destroy_listener;
 	struct wl_listener client_destroy_listener;
@@ -105,34 +105,6 @@
 weston_desktop_view_propagate_layer(struct weston_desktop_view *view);
 
 static void
-weston_desktop_surface_committed_common(struct weston_desktop_surface *surface,
-					bool new_buffer, int32_t sx, int32_t sy)
-{
-	if (surface->implementation->committed != NULL)
-		surface->implementation->committed(surface,
-						   surface->implementation_data,
-						   new_buffer, sx, sy);
-
-	if (surface->parent != NULL) {
-		struct weston_desktop_view *view;
-
-		wl_list_for_each(view, &surface->view_list, link) {
-			weston_view_set_transform_parent(view->view,
-							 view->parent->view);
-			weston_desktop_view_propagate_layer(view->parent);
-		}
-		weston_desktop_surface_update_view_position(surface);
-	}
-
-	if (!wl_list_empty(&surface->children_list)) {
-		struct weston_desktop_surface *child;
-
-		wl_list_for_each(child, &surface->children_list, children_link)
-			weston_desktop_surface_update_view_position(child);
-	}
-}
-
-static void
 weston_desktop_view_destroy(struct weston_desktop_view *view)
 {
 	struct weston_desktop_view *child_view, *tmp;
@@ -197,10 +169,32 @@
 	struct weston_desktop_surface *surface =
 		wl_container_of(listener, surface, surface_commit_listener);
 
-	if (surface->has_new_buffer)
-		surface->has_new_buffer = false;
-	else
-		weston_desktop_surface_committed_common(surface, false, 0, 0);
+	if (surface->implementation->committed != NULL)
+		surface->implementation->committed(surface,
+						   surface->implementation_data,
+						   surface->buffer_move.x,
+						   surface->buffer_move.y);
+
+	if (surface->parent != NULL) {
+		struct weston_desktop_view *view;
+
+		wl_list_for_each(view, &surface->view_list, link) {
+			weston_view_set_transform_parent(view->view,
+							 view->parent->view);
+			weston_desktop_view_propagate_layer(view->parent);
+		}
+		weston_desktop_surface_update_view_position(surface);
+	}
+
+	if (!wl_list_empty(&surface->children_list)) {
+		struct weston_desktop_surface *child;
+
+		wl_list_for_each(child, &surface->children_list, children_link)
+			weston_desktop_surface_update_view_position(child);
+	}
+
+	surface->buffer_move.x = 0;
+	surface->buffer_move.y = 0;
 }
 
 static void
@@ -229,8 +223,8 @@
 {
 	struct weston_desktop_surface *surface = wsurface->committed_private;
 
-	weston_desktop_surface_committed_common(surface, true, sx, sy);
-	surface->has_new_buffer = true;
+	surface->buffer_move.x = sx;
+	surface->buffer_move.y = sy;
 }
 
 static void