[PATCH 1/2] compositor: call configure on surfaces with a null buffer too

Giulio Camuffo giuliocamuffo at gmail.com
Tue Feb 19 11:53:27 PST 2013


This way the shell can know when a surface has been unmapped by
checking the value of pending.remove_content. The configure handlers
must now make sure that the buffer exist though, by checking if
the surface's buffer_ref.buffer is NULL.
---
 src/compositor.c |  2 +-
 src/shell.c      | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/compositor.c b/src/compositor.c
index 64d0830..ea720cd 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1404,7 +1404,7 @@ surface_commit(struct wl_client *client, struct wl_resource *resource)
 	if (surface->pending.buffer || surface->pending.remove_contents)
 		weston_surface_attach(surface, surface->pending.buffer);
 
-	if (surface->buffer_ref.buffer && surface->configure)
+	if (surface->configure)
 		surface->configure(surface, surface->pending.sx,
 				   surface->pending.sy);
 	surface->pending.sx = 0;
diff --git a/src/shell.c b/src/shell.c
index af802a5..345ca8e 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2196,6 +2196,9 @@ configure_static_surface(struct weston_surface *es, struct weston_layer *layer)
 static void
 background_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 {
+	if (!es->buffer_ref.buffer)
+		return;
+
 	struct desktop_shell *shell = es->private;
 
 	configure_static_surface(es, &shell->background_layer);
@@ -2229,6 +2232,9 @@ desktop_shell_set_background(struct wl_client *client,
 static void
 panel_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 {
+	if (!es->buffer_ref.buffer)
+		return;
+
 	struct desktop_shell *shell = es->private;
 
 	configure_static_surface(es, &shell->panel_layer);
@@ -2262,6 +2268,9 @@ desktop_shell_set_panel(struct wl_client *client,
 static void
 lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 {
+	if (!surface->buffer_ref.buffer)
+		return;
+
 	struct desktop_shell *shell = surface->private;
 
 	center_on_output(surface, get_default_output(shell->compositor));
@@ -3088,6 +3097,10 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 {
 	struct shell_surface *shsurf = get_shell_surface(es);
 	struct desktop_shell *shell = shsurf->shell;
+
+	if (!es->buffer_ref.buffer)
+		return;
+
 	int32_t width = weston_surface_buffer_width(es);
 	int32_t height = weston_surface_buffer_height(es);
 	int type_changed = 0;
@@ -3206,6 +3219,9 @@ bind_desktop_shell(struct wl_client *client,
 static void
 screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 {
+	if (!surface->buffer_ref.buffer)
+		return;
+
 	struct desktop_shell *shell = surface->private;
 
 	/* XXX: starting weston-screensaver beforehand does not work */
@@ -3277,6 +3293,9 @@ bind_screensaver(struct wl_client *client,
 static void
 input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 {
+	if (!surface->buffer_ref.buffer)
+		return;
+
 	struct weston_mode *mode;
 	int32_t width = weston_surface_buffer_width(surface);
 	int32_t height = weston_surface_buffer_height(surface);
-- 
1.8.1.3



More information about the wayland-devel mailing list