[PATCH weston] compositor: Interpret cursor position as a fixed point
Rob Bradford
robert.bradford at intel.com
Tue Apr 16 09:04:35 PDT 2013
From: Rob Bradford <rob at linux.intel.com>
The Wayland protocol specifies that the cursor hotspot positions should be
specified as fixed point. Unfortunately weston was prevously accepting those
as integers instead. With this change we accept both but provide a warning if
using the wrong type. For this compatability we assume we'll never get a
fractional hotspot between 0 and 1.
Bug spotted by Henri Tuhola <henri.tuhola at gmail.com>
---
src/compositor.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 693df2c..7ae5e79 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2367,8 +2367,15 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
surface->configure = pointer_cursor_surface_configure;
surface->configure_private = seat;
seat->sprite = surface;
- seat->hotspot_x = x;
- seat->hotspot_y = y;
+
+ if ((x == 0 || (int32_t)x >= 256) && (y == 0 || (int32_t)y >= 256)) {
+ seat->hotspot_x = wl_fixed_to_int((int32_t)x);
+ seat->hotspot_y = wl_fixed_to_int((int32_t)y);
+ } else {
+ weston_log("Client using integers rather than fixed for hotspot.\n");
+ seat->hotspot_x = x;
+ seat->hotspot_y = y;
+ }
if (surface->buffer_ref.buffer)
pointer_cursor_surface_configure(surface, 0, 0, weston_surface_buffer_width(surface),
--
1.8.1.4
More information about the wayland-devel
mailing list