[PATCH 2/5] compositor: only update cursor sprite position on output repaint
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Tue Mar 13 08:23:56 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 f2ae2f6..dc80764 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -901,6 +901,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 +
@@ -1500,13 +1501,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
@@ -1926,6 +1922,27 @@ weston_input_device_release(struct weston_input_device *device)
}
static void
+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
device_setup_new_drag_surface(struct weston_input_device *device,
struct weston_surface *surface)
{
diff --git a/src/compositor.h b/src/compositor.h
index b5ba7b2..669e3f4 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -408,6 +408,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