[PATCH weston] compositor-x11: Consider output position when computing relative motion

Scott Moreau oreaus at gmail.com
Thu Mar 7 20:48:33 PST 2013


This fixes pointer movement for multiple x11 outputs. This was broken
when switching to relative events.
---

I do not currently have a multi-output setup to test drm but it's possible that
evdev needs a similar fix.

 src/compositor-x11.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 8e052dd..db51409 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -1012,8 +1012,8 @@ x11_compositor_deliver_motion_event(struct x11_compositor *c,
 	output = x11_compositor_find_output(c, motion_notify->event);
 	x = wl_fixed_from_int(motion_notify->event_x - c->prev_x);
 	y = wl_fixed_from_int(motion_notify->event_y - c->prev_y);
-	c->prev_x = motion_notify->event_x;
-	c->prev_y = motion_notify->event_y;
+	c->prev_x = motion_notify->event_x + output->base.x;
+	c->prev_y = motion_notify->event_y + output->base.y;
 	x11_output_transform_coordinate(output, &x, &y);
 
 	notify_motion(&c->core_seat, weston_compositor_get_time(), x, y);
@@ -1033,8 +1033,8 @@ x11_compositor_deliver_enter_event(struct x11_compositor *c,
 	if (!c->has_xkb)
 		update_xkb_state_from_core(c, enter_notify->state);
 	output = x11_compositor_find_output(c, enter_notify->event);
-	c->prev_x = enter_notify->event_x;
-	c->prev_y = enter_notify->event_y;
+	c->prev_x = enter_notify->event_x + output->base.x;
+	c->prev_y = enter_notify->event_y + output->base.y;
 	x = wl_fixed_from_int(enter_notify->event_x);
 	y = wl_fixed_from_int(enter_notify->event_y);
 	x11_output_transform_coordinate(output, &x, &y);
-- 
1.7.10.4



More information about the wayland-devel mailing list