[PATCH] compositor: send a pointer motion if the focus surface moves under the pointer

Giulio Camuffo giuliocamuffo at gmail.com
Thu Feb 21 06:52:38 PST 2013


---
 src/compositor.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 64d0830..45d7c88 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -776,6 +776,7 @@ weston_device_repick(struct weston_seat *seat)
 	const struct wl_pointer_grab_interface *interface;
 	struct weston_surface *surface, *focus;
 	struct wl_pointer *pointer = seat->seat.pointer;
+	int32_t curr_x, curr_y;
 
 	if (!pointer)
 		return;
@@ -783,15 +784,23 @@ weston_device_repick(struct weston_seat *seat)
 	surface = weston_compositor_pick_surface(seat->compositor,
 						 pointer->x,
 						 pointer->y,
-						 &pointer->current_x,
-						 &pointer->current_y);
+						 &curr_x,
+						 &curr_y);
 
 	if (&surface->surface != pointer->current) {
 		interface = pointer->grab->interface;
 		pointer->current = &surface->surface;
+		pointer->current_x = curr_x;
+		pointer->current_y = curr_y;
 		interface->focus(pointer->grab, &surface->surface,
 				 pointer->current_x,
 				 pointer->current_y);
+	} else if (pointer->current_x != curr_x ||
+			pointer->current_y != curr_y) {
+		/* The current surface moved under the cursor, send
+		 * a motion event. */
+		pointer->grab->interface->motion(pointer->grab,
+				weston_compositor_get_time(), curr_x, curr_y);
 	}
 
 	focus = (struct weston_surface *) pointer->grab->focus;
-- 
1.8.1.3



More information about the wayland-devel mailing list