[PATCH 1/2] compositor: only update cursor sprite position on output repaint

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Thu Mar 29 00:56:29 PDT 2012


---
 src/compositor.c |   29 +++++++++++++++++++++++------
 src/compositor.h |    2 ++
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index f9e1f23..158acf8 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -934,6 +934,7 @@ weston_output_repaint(struct weston_output *output, int msecs)
 	pixman_region32_t opaque, new_damage, output_damage;
 	int32_t width, height;
 
+	weston_compositor_update_cursor_sprites(ec);
 	weston_compositor_update_drag_surfaces(ec);
 
 	width = output->current->width +
@@ -1505,13 +1506,8 @@ notify_motion(struct wl_input_device *device, uint32_t time, int x, int y)
 	interface->motion(device->pointer_grab, time,
 			  device->pointer_grab->x, device->pointer_grab->y);
 
-	if (wd->sprite) {
-		weston_surface_set_position(wd->sprite,
-					    device->x - wd->hotspot_x,
-					    device->y - wd->hotspot_y);
-
+	if (wd->sprite)
 		weston_compositor_schedule_repaint(ec);
-	}
 }
 
 WL_EXPORT void
@@ -1990,6 +1986,27 @@ weston_input_device_release(struct weston_input_device *device)
 	wl_input_device_release(&device->input_device);
 }
 
+static int
+device_update_cursor_sprite(struct weston_input_device *device)
+{
+	int x, y;
+
+	x = device->input_device.x - device->hotspot_x;
+	y = device->input_device.y - device->hotspot_y;
+
+	if (device->sprite)
+		weston_surface_set_position(device->sprite, x, y);
+}
+
+WL_EXPORT void
+weston_compositor_update_cursor_sprites(struct weston_compositor *compositor)
+{
+	struct weston_input_device *device = (struct weston_input_device *)
+		compositor->input_device;
+
+	device_update_cursor_sprite(device);
+}
+
 static void
 drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 {
diff --git a/src/compositor.h b/src/compositor.h
index 1410631..cd420f6 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -422,6 +422,8 @@ weston_compositor_wake(struct weston_compositor *compositor);
 void
 weston_compositor_activity(struct weston_compositor *compositor);
 void
+weston_compositor_update_cursor_sprites(struct weston_compositor *compositor);
+void
 weston_compositor_update_drag_surfaces(struct weston_compositor *compositor);
 
 
-- 
1.7.4.1



More information about the wayland-devel mailing list