[PATCH weston 1/6] window: make display_create_surface() shm-only

Kristian Høgsberg hoegsberg at gmail.com
Tue Nov 27 13:05:13 PST 2012


On Mon, Nov 19, 2012 at 05:15:57PM +0200, Pekka Paalanen wrote:
> Nothing uses it to create EGL-surfaces outside of window.c. This makes
> refactoring the EGL-based code easier, since we do not need to support
> EGL-based Cairo surfaces without an associated struct window.

This entire series applied now.  I had a few nitpick comments to some
of the patches but they're all applied.  I don't like the struct
toysurface name, I think it should just be struct surface, since
everything else in toytoolkit is not prefixed.  Of we should go in the
other direction and prefix everything, which may be long overdue
anyway.  Currently it's hard to tell toytoolkit code from sample
client code.  How about we just call it weston toolkit and prefix it
all wtk?

  d = wtk_display_create();

  wtk_window_destroy(win);

etc... and rename window.[ch] to wtk.[ch] Or maybe we want to split it
into wtk-display.c, wtk-window.c, wtk-surface-egl.c etc...

Kristian

> Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
> ---
>  clients/window.c |   20 +++++++++-----------
>  1 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/clients/window.c b/clients/window.c
> index 44a057c..8cf53d3 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -636,13 +636,8 @@ display_create_surface(struct display *display,
>  {
>  	if (check_size(rectangle) < 0)
>  		return NULL;
> -#ifdef HAVE_CAIRO_EGL
> -	if (display->dpy && !(flags & SURFACE_SHM))
> -		return display_create_egl_window_surface(display,
> -							 surface,
> -							 flags,
> -							 rectangle);
> -#endif
> +
> +	assert(flags & SURFACE_SHM);
>  	return display_create_shm_surface(display, rectangle, flags, NULL);
>  }
>  
> @@ -940,10 +935,13 @@ window_create_surface(struct window *window)
>  			window_resize_cairo_window_surface(window);
>  			return;
>  		}
> -		surface = display_create_surface(window->display,
> -						 window->surface,
> -						 &window->allocation, flags);
> -		break;
> +		if (window->display->dpy) {
> +			surface = display_create_egl_window_surface(
> +					window->display, window->surface,
> +					flags, &window->allocation);
> +			break;
> +		}
> +		/* fall through */
>  #endif
>  	case WINDOW_BUFFER_TYPE_SHM:
>  		surface = display_create_shm_surface(window->display,
> -- 
> 1.7.8.6
> 


More information about the wayland-devel mailing list