From: Rob Bradford <[email protected]>

The Wayland protocol specifies that the values to be passed in for the cursor
hotspot should be fixed point. Unfortunately weston was expecting integers -
since most clients pass the values from the cursor API into the set_cursor
call we can minimize the impact of fixing the bug in weston by exposing the
values fixed point.

Bug spotted by Henri Tuhola <[email protected]>
---
 cursor/wayland-cursor.c | 8 ++++----
 cursor/wayland-cursor.h | 5 +++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c
index 25e51c2..e6e464a 100644
--- a/cursor/wayland-cursor.c
+++ b/cursor/wayland-cursor.c
@@ -220,8 +220,8 @@ wl_cursor_create_from_data(struct cursor_metadata *metadata,
        image->buffer = NULL;
        image->image.width = metadata->width;
        image->image.height = metadata->height;
-       image->image.hotspot_x = metadata->hotspot_x;
-       image->image.hotspot_y = metadata->hotspot_y;
+       image->image.hotspot_x = wl_fixed_from_int(metadata->hotspot_x);
+       image->image.hotspot_y = wl_fixed_from_int(metadata->hotspot_y);
        image->image.delay = 0;
 
        size = metadata->width * metadata->height * sizeof(uint32_t);
@@ -280,8 +280,8 @@ wl_cursor_create_from_xcursor_images(XcursorImages *images,
 
                image->image.width = images->images[i]->width;
                image->image.height = images->images[i]->height;
-               image->image.hotspot_x = images->images[i]->xhot;
-               image->image.hotspot_y = images->images[i]->yhot;
+               image->image.hotspot_x = 
wl_fixed_from_int(images->images[i]->xhot);
+               image->image.hotspot_y = 
wl_fixed_from_int(images->images[i]->yhot);
                image->image.delay = images->images[i]->delay;
                cursor->total_delay += image->image.delay;
 
diff --git a/cursor/wayland-cursor.h b/cursor/wayland-cursor.h
index c7548ae..836f6ed 100644
--- a/cursor/wayland-cursor.h
+++ b/cursor/wayland-cursor.h
@@ -24,6 +24,7 @@
 #define WAYLAND_CURSOR_H
 
 #include <stdint.h>
+#include <wayland-util.h>
 
 #ifdef  __cplusplus
 extern "C" {
@@ -34,8 +35,8 @@ struct wl_cursor_theme;
 struct wl_cursor_image {
        uint32_t width;         /* actual width */
        uint32_t height;        /* actual height */
-       uint32_t hotspot_x;     /* hot spot x (must be inside image) */
-       uint32_t hotspot_y;     /* hot spot y (must be inside image) */
+       wl_fixed_t hotspot_x;   /* hot spot x (must be inside image) */
+       wl_fixed_t hotspot_y;   /* hot spot y (must be inside image) */
        uint32_t delay;         /* animation delay to next frame (ms) */
 };
 
-- 
1.8.1.4

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to