Fixed the hotspot for cursors on Raspberry Pi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/video/raspberry/SDL_rpimouse.c b/src/video/raspberry/SDL_rpimouse.c
index 650b1f3..4deb1dd 100644
--- a/src/video/raspberry/SDL_rpimouse.c
+++ b/src/video/raspberry/SDL_rpimouse.c
@@ -171,7 +171,7 @@ RPI_ShowCursor(SDL_Cursor * cursor)
if (curdata->element == DISPMANX_NO_HANDLE) {
vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
- vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h);
+ vc_dispmanx_rect_set(&dst_rect, mouse->x - curdata->hot_x, mouse->y - curdata->hot_y, curdata->w, curdata->h);
update = vc_dispmanx_update_start(0);
SDL_assert(update);
@@ -190,7 +190,7 @@ RPI_ShowCursor(SDL_Cursor * cursor)
DISPMANX_PROTECTION_NONE,
&alpha,
DISPMANX_NO_HANDLE, // clamp
- VC_IMAGE_ROT0);
+ DISPMANX_NO_ROTATE);
SDL_assert(curdata->element > DISPMANX_NO_HANDLE);
ret = vc_dispmanx_update_submit_sync(update);
SDL_assert(ret == DISPMANX_SUCCESS);
@@ -270,8 +270,8 @@ RPI_WarpMouseGlobal(int x, int y)
src_rect.y = 0;
src_rect.width = curdata->w << 16;
src_rect.height = curdata->h << 16;
- dst_rect.x = x;
- dst_rect.y = y;
+ dst_rect.x = x - curdata->hot_x;
+ dst_rect.y = y - curdata->hot_y;
dst_rect.width = curdata->w;
dst_rect.height = curdata->h;
@@ -326,8 +326,8 @@ RPI_WarpMouseGlobalGraphicOnly(int x, int y)
src_rect.y = 0;
src_rect.width = curdata->w << 16;
src_rect.height = curdata->h << 16;
- dst_rect.x = x;
- dst_rect.y = y;
+ dst_rect.x = x - curdata->hot_x;
+ dst_rect.y = y - curdata->hot_y;
dst_rect.width = curdata->w;
dst_rect.height = curdata->h;