[PATCH 2/4] compositor: only update cursor sprite position on output repaint
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Tue Apr 3 05:44:16 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 1fce69a..3d70853 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
@@ -1991,6 +1987,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
drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
{
weston_surface_configure(es,
diff --git a/src/compositor.h b/src/compositor.h
index 9f8f57d..a0ce4df 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -417,6 +417,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