Fixed the hotspot for cursors on Raspberry Pi
authorSam Lantinga <slouken@libsdl.org>
Tue, 27 Nov 2018 11:16:04 -0800
changeset 12434164473244292
parent 12433 fdddcd7d940d
child 12435 261716de5769
Fixed the hotspot for cursors on Raspberry Pi
src/video/raspberry/SDL_rpimouse.c
     1.1 --- a/src/video/raspberry/SDL_rpimouse.c	Tue Nov 27 10:20:29 2018 -0800
     1.2 +++ b/src/video/raspberry/SDL_rpimouse.c	Tue Nov 27 11:16:04 2018 -0800
     1.3 @@ -171,7 +171,7 @@
     1.4      
     1.5      if (curdata->element == DISPMANX_NO_HANDLE) {
     1.6          vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
     1.7 -        vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h);
     1.8 +        vc_dispmanx_rect_set(&dst_rect, mouse->x - curdata->hot_x, mouse->y - curdata->hot_y, curdata->w, curdata->h);
     1.9          
    1.10          update = vc_dispmanx_update_start(0);
    1.11          SDL_assert(update);
    1.12 @@ -190,7 +190,7 @@
    1.13                                                      DISPMANX_PROTECTION_NONE,
    1.14                                                      &alpha,
    1.15                                                      DISPMANX_NO_HANDLE, // clamp
    1.16 -                                                    VC_IMAGE_ROT0);
    1.17 +                                                    DISPMANX_NO_ROTATE);
    1.18          SDL_assert(curdata->element > DISPMANX_NO_HANDLE);
    1.19          ret = vc_dispmanx_update_submit_sync(update);
    1.20          SDL_assert(ret == DISPMANX_SUCCESS);
    1.21 @@ -270,8 +270,8 @@
    1.22      src_rect.y = 0;
    1.23      src_rect.width  = curdata->w << 16;
    1.24      src_rect.height = curdata->h << 16;
    1.25 -    dst_rect.x = x;
    1.26 -    dst_rect.y = y;
    1.27 +    dst_rect.x = x - curdata->hot_x;
    1.28 +    dst_rect.y = y - curdata->hot_y;
    1.29      dst_rect.width  = curdata->w;
    1.30      dst_rect.height = curdata->h;
    1.31  
    1.32 @@ -326,8 +326,8 @@
    1.33      src_rect.y = 0;
    1.34      src_rect.width  = curdata->w << 16;
    1.35      src_rect.height = curdata->h << 16;
    1.36 -    dst_rect.x = x;
    1.37 -    dst_rect.y = y;
    1.38 +    dst_rect.x = x - curdata->hot_x;
    1.39 +    dst_rect.y = y - curdata->hot_y;
    1.40      dst_rect.width  = curdata->w;
    1.41      dst_rect.height = curdata->h;
    1.42