We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4699 - [Raspberry Pi] No cursor displayed as of changeset 12433
Summary: [Raspberry Pi] No cursor displayed as of changeset 12433
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.10
Hardware: ARM Other
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.10
Depends on:
Blocks:
 
Reported: 2019-06-29 23:37 UTC by Joe LeVeque
Modified: 2019-07-02 20:50 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe LeVeque 2019-06-29 23:37:37 UTC
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. Below is a small patch which fixes the issue:


--- SDL_rpimouse.c      2019-06-29 15:42:36.724201038 -0700
+++ SDL_rpimouse.c      2019-06-29 15:48:03.772143536 -0700
@@ -128,23 +128,21 @@
         return -1;
     }

-    if (cursor == global_cursor) {
-        return 0;
-    }
-
-    if (global_cursor != NULL) {
-        curdata = (RPI_CursorData *) global_cursor->driverdata;
-        if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
-            update = vc_dispmanx_update_start(0);
-            SDL_assert(update);
-            ret = vc_dispmanx_element_remove(update, curdata->element);
-            SDL_assert(ret == DISPMANX_SUCCESS);
-            ret = vc_dispmanx_update_submit_sync(update);
-            SDL_assert(ret == DISPMANX_SUCCESS);
-            curdata->element = DISPMANX_NO_HANDLE;
+    if (cursor != global_cursor) {
+        if (global_cursor != NULL) {
+            curdata = (RPI_CursorData *) global_cursor->driverdata;
+            if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
+                update = vc_dispmanx_update_start(0);
+                SDL_assert(update);
+                ret = vc_dispmanx_element_remove(update, curdata->element);
+                SDL_assert(ret == DISPMANX_SUCCESS);
+                ret = vc_dispmanx_update_submit_sync(update);
+                SDL_assert(ret == DISPMANX_SUCCESS);
+                curdata->element = DISPMANX_NO_HANDLE;
+            }
         }
+        global_cursor = cursor;
     }
-    global_cursor = cursor;

     if (cursor == NULL) {
         return 0;
Comment 1 Ryan C. Gordon 2019-06-29 23:38:33 UTC
Looking at this tonight. Should probably get this into 2.0.10.

--ryan.
Comment 2 Ryan C. Gordon 2019-07-02 14:27:18 UTC
This patch is now https://hg.libsdl.org/SDL/rev/db02dca46a9e, thanks!

--ryan.
Comment 3 Joe LeVeque 2019-07-02 20:40:19 UTC
Hi Ryan. Thanks for looking into this so quickly and merging the patch. I have not had a chance to test the new changes, but I believe the problem will still exist because the first lines of my patch were not applied:

-    if (cursor == global_cursor) {
-        return 0;
-    }
-

Without removing this if statement, the function will still exit prematurely and the cursor will not be displayed. Can you please take another look?
Comment 4 Ryan C. Gordon 2019-07-02 20:50:16 UTC
Whoops, "hg record" error on my end, sorry!

The missing patch fragment is now at https://hg.libsdl.org/SDL/rev/9cbdc68e4a5e, thank you again!

--ryan.