raspberry: Fixed missing mouse cursor (thanks, Joe!)
authorRyan C. Gordon <icculus@icculus.org>
Tue, 02 Jul 2019 10:26:54 -0400
changeset 12922db02dca46a9e
parent 12921 5959fcbe6dfe
child 12923 73091a9e72f7
raspberry: Fixed missing mouse cursor (thanks, Joe!)

"Starting with changeset 12433, the mouse cursor is not displayed on the
Raspberry Pi platform, due to a bug in the handling of the new
"global_cursor" in RPI_ShowCursor(). Currently, if cursor == global_cursor,
the function immediately returns 0. The function should not return here.
Instead, if cursor == global_cursor, it shouldn't try to hide the current
cursor and update global_cursor = cursor. However, it *should* still continue
through the rest of the function."

Fixes Bugzilla #4699.
src/video/raspberry/SDL_rpimouse.c
     1.1 --- a/src/video/raspberry/SDL_rpimouse.c	Tue Jul 02 09:43:26 2019 -0400
     1.2 +++ b/src/video/raspberry/SDL_rpimouse.c	Tue Jul 02 10:26:54 2019 -0400
     1.3 @@ -132,19 +132,21 @@
     1.4          return 0;
     1.5      }
     1.6  
     1.7 -    if (global_cursor != NULL) {
     1.8 -        curdata = (RPI_CursorData *) global_cursor->driverdata;
     1.9 -        if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
    1.10 -            update = vc_dispmanx_update_start(0);
    1.11 -            SDL_assert(update);
    1.12 -            ret = vc_dispmanx_element_remove(update, curdata->element);
    1.13 -            SDL_assert(ret == DISPMANX_SUCCESS);
    1.14 -            ret = vc_dispmanx_update_submit_sync(update);
    1.15 -            SDL_assert(ret == DISPMANX_SUCCESS);
    1.16 -            curdata->element = DISPMANX_NO_HANDLE;
    1.17 +    if (cursor != global_cursor) {
    1.18 +        if (global_cursor != NULL) {
    1.19 +            curdata = (RPI_CursorData *) global_cursor->driverdata;
    1.20 +            if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
    1.21 +                update = vc_dispmanx_update_start(0);
    1.22 +                SDL_assert(update);
    1.23 +                ret = vc_dispmanx_element_remove(update, curdata->element);
    1.24 +                SDL_assert(ret == DISPMANX_SUCCESS);
    1.25 +                ret = vc_dispmanx_update_submit_sync(update);
    1.26 +                SDL_assert(ret == DISPMANX_SUCCESS);
    1.27 +                curdata->element = DISPMANX_NO_HANDLE;
    1.28 +            }
    1.29          }
    1.30 +        global_cursor = cursor;
    1.31      }
    1.32 -    global_cursor = cursor;
    1.33  
    1.34      if (cursor == NULL) {
    1.35          return 0;