[PATCH 2/5] compositor: Split pointer motion code into its own function

Kristian Høgsberg krh at bitplanet.net
Mon Feb 25 18:33:22 PST 2013


---
 src/compositor.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index e965648..d8bc00c 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1693,17 +1693,14 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
 	}
 }
 
-WL_EXPORT void
-notify_motion(struct weston_seat *seat, uint32_t time, wl_fixed_t x, wl_fixed_t y)
+static void
+move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
 {
-	const struct wl_pointer_grab_interface *interface;
 	struct weston_compositor *ec = seat->compositor;
-	struct weston_output *output;
 	struct wl_pointer *pointer = seat->seat.pointer;
+	struct weston_output *output;
 	int32_t ix, iy;
 
-	weston_compositor_wake(ec);
-
 	clip_pointer_motion(seat, &x, &y);
 
 	weston_seat_update_drag_surface(seat, x - pointer->x, y - pointer->y);
@@ -1721,9 +1718,6 @@ notify_motion(struct weston_seat *seat, uint32_t time, wl_fixed_t x, wl_fixed_t
 			weston_output_update_zoom(output, ZOOM_FOCUS_POINTER);
 
 	weston_device_repick(seat);
-	interface = pointer->grab->interface;
-	interface->motion(pointer->grab, time,
-			  pointer->grab->x, pointer->grab->y);
 
 	if (seat->sprite) {
 		weston_surface_set_position(seat->sprite,
@@ -1734,6 +1728,23 @@ notify_motion(struct weston_seat *seat, uint32_t time, wl_fixed_t x, wl_fixed_t
 }
 
 WL_EXPORT void
+notify_motion(struct weston_seat *seat,
+	      uint32_t time, wl_fixed_t x, wl_fixed_t y)
+{
+	const struct wl_pointer_grab_interface *interface;
+	struct weston_compositor *ec = seat->compositor;
+	struct wl_pointer *pointer = seat->seat.pointer;
+
+	weston_compositor_wake(ec);
+
+	move_pointer(seat, x, y);
+
+	interface = pointer->grab->interface;
+	interface->motion(pointer->grab, time,
+			  pointer->grab->x, pointer->grab->y);
+}
+
+WL_EXPORT void
 weston_surface_activate(struct weston_surface *surface,
 			struct weston_seat *seat)
 {
-- 
1.8.1.2



More information about the wayland-devel mailing list