[PATCH fullscreen-shell v6 09/19] toytoolkit: Don't crash if wl_data_device_manager is not present

Bryce W. Harrington b.harrington at samsung.com
Tue Apr 8 11:19:33 PDT 2014


On Wed, Apr 02, 2014 at 07:53:51PM -0500, Jason Ekstrand wrote:
> This is primaraly to get weston-fullscreen to run on compositors that lack

primarily

> copy-paste support.
> 
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
>  clients/window.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/clients/window.c b/clients/window.c
> index 5309f31..8393424 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -3507,7 +3507,8 @@ void
>  input_set_selection(struct input *input,
>  		    struct wl_data_source *source, uint32_t time)
>  {
> -	wl_data_device_set_selection(input->data_device, source, time);
> +	if (input->data_device)
> +		wl_data_device_set_selection(input->data_device, source, time);
>  }
>  
>  void
> @@ -4903,11 +4904,14 @@ display_add_input(struct display *d, uint32_t id)
>  	wl_seat_add_listener(input->seat, &seat_listener, input);
>  	wl_seat_set_user_data(input->seat, input);
>  
> -	input->data_device =
> -		wl_data_device_manager_get_data_device(d->data_device_manager,
> -						       input->seat);
> -	wl_data_device_add_listener(input->data_device, &data_device_listener,
> -				    input);
> +	if (d->data_device_manager) {
> +		input->data_device =
> +			wl_data_device_manager_get_data_device(d->data_device_manager,
> +							       input->seat);
> +		wl_data_device_add_listener(input->data_device,
> +					    &data_device_listener,
> +					    input);
> +	}
>  
>  	input->pointer_surface = wl_compositor_create_surface(d->compositor);
>  
> @@ -4930,7 +4934,8 @@ input_destroy(struct input *input)
>  	if (input->selection_offer)
>  		data_offer_destroy(input->selection_offer);
>  
> -	wl_data_device_destroy(input->data_device);
> +	if (input->data_device)
> +		wl_data_device_destroy(input->data_device);
>  
>  	if (input->display->seat_version >= 3) {
>  		if (input->pointer)
> @@ -5413,7 +5418,10 @@ display_get_egl_display(struct display *d)
>  struct wl_data_source *
>  display_create_data_source(struct display *display)
>  {
> -	return wl_data_device_manager_create_data_source(display->data_device_manager);
> +	if (display->data_device_manager)
> +		return wl_data_device_manager_create_data_source(display->data_device_manager);
> +	else
> +		return NULL;
>  }
>  
>  EGLConfig
> -- 
> 1.9.0
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list