From b7be5bce33bf53fe62c9345379a9b08e3cb22703 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 19 Dec 2017 11:17:37 -0800 Subject: [PATCH] Fixed bug 4000 - SDL2 on raspberry: mouse displayed at 0,0 after SDL_ShowCursor Laurent Merckx I have a problem with the SDL_ShowCursor method on Raspberry. Depending on the context, my application hides or show the mouse cursor with SDL_ShowCursor. But when calling SDL_ShowCursor(true), the cursor is displayed at 0,0 (and not at last position). After debugging sources by myself, it seems that the problem is in SDL_rpimouse.c - RPI_ShowCursor: vc_dispmanx_rect_set( &dst_rect, 0, 0, curdata->w, curdata->h); should be vc_dispmanx_rect_set( &dst_rect, mouse->x, mouse->y, curdata->w, curdata->h); For me, it solves the problem. --- src/video/raspberry/SDL_rpimouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/raspberry/SDL_rpimouse.c b/src/video/raspberry/SDL_rpimouse.c index 4ab9c7788c8fd..907204fffac49 100644 --- a/src/video/raspberry/SDL_rpimouse.c +++ b/src/video/raspberry/SDL_rpimouse.c @@ -165,7 +165,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, 0, 0, curdata->w, curdata->h); + vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h); update = vc_dispmanx_update_start(10); SDL_assert(update);