compositor-drm: Enable seat constraining when configured in weston.ini
This change tweaks weston_pointer_clamp to take into consideration if a
seat is constrained to a particular output by only considering the
pointer position valid if it is within the output we a constrained to.
This function is also used for the initial warping of the pointer when a
constraint is first established.
The other two changes are the application of the constraint when either
a new device added or a new output created and therefore outputs and
input devices can be brought up in either order.
v2: the code in create_output_for_connector has been spun off into a
new function setup_output_seat_constraint (Ander). The inappropriate
warping behaviour has been resolved by using weston_pointer_clamp
(Pekka).
diff --git a/src/input.c b/src/input.c
index 004d063..1737beb 100644
--- a/src/input.c
+++ b/src/input.c
@@ -574,6 +574,8 @@
old_y = wl_fixed_to_int(pointer->y);
wl_list_for_each(output, &ec->output_list, link) {
+ if (pointer->seat->output && pointer->seat->output != output)
+ continue;
if (pixman_region32_contains_point(&output->region,
x, y, NULL))
valid = 1;
@@ -582,7 +584,10 @@
prev = output;
}
- if (!valid) {
+ if (!prev)
+ prev = pointer->seat->output;
+
+ if (prev && !valid) {
if (x < prev->x)
*fx = wl_fixed_from_int(prev->x);
else if (x >= prev->x + prev->width)