[fullscreen-v8 PATCH 1/3] compositor: Export functions and add weston_suface::force_configure for fullscreen

Kristian Hoegsberg hoegsberg at gmail.com
Tue Feb 28 05:52:14 PST 2012


On Tue, Feb 28, 2012 at 06:07:54PM +0800, zhiwen.wu at linux.intel.com wrote:
> From: Alex Wu <zhiwen.wu at linux.intel.com>

Thanks, applied with a little edit to make the check in
weston_surface_destroy an assert instead.  If we end up in that case,
it's an internal error and we need to catch it, not silently ignore
it.

Also, please format comments like other comments in the code (space
between /* and the comment text and */.

Kristian

> This will facilitate the implementation of fullscreen.
> 
> Signed-off-by: Alex Wu <zhiwen.wu at linux.intel.com>
> ---
>  src/compositor.c |   16 ++++++++++++++--
>  src/compositor.h |    9 +++++++++
>  2 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index b12c583..022c7a1 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -212,6 +212,7 @@ weston_surface_create(struct weston_compositor *compositor)
>  
>  	surface->buffer = NULL;
>  	surface->output = NULL;
> +	surface->force_configure = 0;
>  
>  	pixman_region32_init(&surface->damage);
>  	pixman_region32_init(&surface->opaque);
> @@ -231,7 +232,7 @@ weston_surface_create(struct weston_compositor *compositor)
>  	return surface;
>  }
>  
> -static void
> +WL_EXPORT void
>  weston_surface_set_color(struct weston_surface *surface,
>  		 GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
>  {
> @@ -639,6 +640,16 @@ destroy_surface(struct wl_resource *resource)
>  	free(surface);
>  }
>  
> +WL_EXPORT void
> +weston_surface_destroy(struct weston_surface *surface)
> +{
> +	/*not trying to destroy a client surface this way*/
> +	if (surface->surface.resource.client != NULL)
> +		return;
> +
> +	destroy_surface(&surface->surface.resource);
> +}
> +
>  static void
>  weston_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
>  {
> @@ -1132,7 +1143,7 @@ surface_attach(struct wl_client *client,
>  
>  	if (es->output == NULL) {
>  		shell->map(shell, es, buffer->width, buffer->height, sx, sy);
> -	} else if (sx != 0 || sy != 0 ||
> +	} else if (es->force_configure || sx != 0 || sy != 0 ||
>  		   es->geometry.width != buffer->width ||
>  		   es->geometry.height != buffer->height) {
>  		GLfloat from_x, from_y;
> @@ -1144,6 +1155,7 @@ surface_attach(struct wl_client *client,
>  				 es->geometry.x + to_x - from_x,
>  				 es->geometry.y + to_y - from_y,
>  				 buffer->width, buffer->height);
> +		es->force_configure = 0;
>  	}
>  
>  	weston_buffer_attach(buffer, &es->surface);
> diff --git a/src/compositor.h b/src/compositor.h
> index 881f53c..dd9cb20 100644
> --- a/src/compositor.h
> +++ b/src/compositor.h
> @@ -301,6 +301,8 @@ struct weston_surface {
>  
>  	struct wl_buffer *buffer;
>  	struct wl_listener buffer_destroy_listener;
> +
> +	int force_configure;
>  };
>  
>  void
> @@ -507,4 +509,11 @@ struct weston_zoom *
>  weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
>  		weston_zoom_done_func_t done, void *data);
>  
> +void
> +weston_surface_set_color(struct weston_surface *surface,
> +			 GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
> +
> +void
> +weston_surface_destroy(struct weston_surface *surface);
> +
>  #endif
> -- 
> 1.7.5.4
> 


More information about the wayland-devel mailing list