[PATCH weston 3/4] compositor-drm: Enable seat constraining when configured in weston.ini

Ander Conselvan de Oliveira conselvan2 at gmail.com
Tue Jun 11 06:06:12 PDT 2013


On 06/10/2013 05:17 PM, Rob Bradford wrote:
> From: Rob Bradford <rob at linux.intel.com>
>
> ---
>   src/compositor-drm.c | 16 ++++++++++++++++
>   src/compositor.h     |  2 ++
>   src/input.c          |  2 ++
>   src/udev-seat.c      |  3 +++
>   4 files changed, 23 insertions(+)
>
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 76d0810..7d33977 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -1796,6 +1796,22 @@ create_output_for_connector(struct drm_compositor *ec,
>   	transform = parse_transform(s, output->base.name);
>   	free(s);
>
> +	weston_config_section_get_string(section, "seat", &s, "");
> +	if (strcmp(s, "") != 0) {
> +		struct udev_seat *seat;
> +
> +		seat = udev_seat_get_named(&ec->base, s);
> +		if (seat) {
> +			seat->base.output = &output->base;
> +			if (seat->base.pointer) {
> +				weston_pointer_output_center(seat->base.pointer,
> +							     &output->base);
> +			}
> +		}
> +	}
> +
> +	free(s);
> +

I'd prefer if this was in a separate function. The function 
create_output_for_connector() is too long as it is. And doing that you 
could probably get rid of one indentation level, which would let you 
rename weston_pointer_output_center() as 
weston_pointer_center_on_output() (which is clearer IMO) without 
breaking the 80 characters limit.

Cheers,
Ander

>   	output->crtc_id = resources->crtcs[i];
>   	output->pipe = i;
>   	ec->crtc_allocator |= (1 << output->crtc_id);
> diff --git a/src/compositor.h b/src/compositor.h
> index d2ca844..68845ab 100644
> --- a/src/compositor.h
> +++ b/src/compositor.h
> @@ -425,6 +425,8 @@ struct weston_seat {
>   	struct weston_keyboard *keyboard;
>   	struct weston_touch *touch;
>
> +	struct weston_output *output; /* constraint */
> +
>   	struct wl_signal destroy_signal;
>
>   	struct weston_compositor *compositor;
> diff --git a/src/input.c b/src/input.c
> index 7c7aa95..ef99899 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -585,6 +585,8 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
>   	old_y = wl_fixed_to_int(seat->pointer->y);
>
>   	wl_list_for_each(output, &ec->output_list, link) {
> +		if (seat->output && seat->output != output)
> +			continue;
>   		if (pixman_region32_contains_point(&output->region,
>   						   x, y, NULL))
>   			valid = 1;
> diff --git a/src/udev-seat.c b/src/udev-seat.c
> index bd25535..8df588a 100644
> --- a/src/udev-seat.c
> +++ b/src/udev-seat.c
> @@ -115,6 +115,9 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
>
>   	wl_list_insert(seat->devices_list.prev, &device->link);
>
> +	if (seat->base.output && seat->base.pointer)
> +		weston_pointer_output_center(seat->base.pointer, seat->base.output);
> +
>   	return 0;
>   }
>
>



More information about the wayland-devel mailing list