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

Rob Bradford robert.bradford at intel.com
Mon Jun 10 07:17:30 PDT 2013


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);
+
 	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;
 }
 
-- 
1.8.1.4



More information about the wayland-devel mailing list