[PATCH weston] compositor-x11: Fix multiple outputs

Philipp Brüschweiler blei42 at gmail.com
Sun Mar 10 07:46:58 PDT 2013


Fixes https://bugs.freedesktop.org/show_bug.cgi?id=61672
---
 src/compositor-x11.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 8e052dd..85318d9 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -90,8 +90,8 @@ struct x11_compositor {
 	/* We could map multi-pointer X to multiple wayland seats, but
 	 * for now we only support core X input. */
 	struct weston_seat		 core_seat;
-	int				 prev_x;
-	int				 prev_y;
+	wl_fixed_t			 prev_x;
+	wl_fixed_t			 prev_y;
 
 	struct {
 		xcb_atom_t		 wm_protocols;
@@ -1003,18 +1003,20 @@ x11_compositor_deliver_motion_event(struct x11_compositor *c,
 					xcb_generic_event_t *event)
 {
 	struct x11_output *output;
-	wl_fixed_t x, y;
+	wl_fixed_t x, y, event_x, event_y;
 	xcb_motion_notify_event_t *motion_notify =
 			(xcb_motion_notify_event_t *) event;
 
 	if (!c->has_xkb)
 		update_xkb_state_from_core(c, motion_notify->state);
 	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;
-	x11_output_transform_coordinate(output, &x, &y);
+	event_x = wl_fixed_from_int(motion_notify->event_x);
+	event_y = wl_fixed_from_int(motion_notify->event_y);
+	x11_output_transform_coordinate(output, &event_x, &event_y);
+	x = event_x - c->prev_x;
+	y = event_y - c->prev_y;
+	c->prev_x = event_x;
+	c->prev_y = event_y;
 
 	notify_motion(&c->core_seat, weston_compositor_get_time(), x, y);
 }
@@ -1033,11 +1035,11 @@ 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;
 	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);
+	c->prev_x = x;
+	c->prev_y = y;
 
 	notify_pointer_focus(&c->core_seat, &output->base, x, y);
 }
-- 
1.8.1.5



More information about the wayland-devel mailing list