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 3149 - Mouse Pointer Raspberry Pi corrupt when moving over screen edges
Summary: Mouse Pointer Raspberry Pi corrupt when moving over screen edges
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: ARM Linux
: P2 blocker
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-12 18:56 UTC by Patrick Gutlich
Modified: 2016-10-01 21:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Gutlich 2015-10-12 18:56:09 UTC
The mouse cursor gets corrupted when the mouse moves over the screen edges (right and bottom) a weird type of scaling seems to occur and you end up with a blank square.

Suggested Fix for sdl_rpimouse.c:

/* Warp the mouse to (x,y) */
static int
RPI_WarpMouseGlobal(int x, int y)
{
    RPI_CursorData *curdata;
    DISPMANX_UPDATE_HANDLE_T update;
    int ret;
    VC_RECT_T dst_rect;
    VC_RECT_T src_rect;
    SDL_Mouse *mouse = SDL_GetMouse();
    
    if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
        curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
        if (curdata->element != DISPMANX_NO_HANDLE) {
            update = vc_dispmanx_update_start( 10 );
            SDL_assert( update );
            src_rect.x = 0;
            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.width  = curdata->w;
            dst_rect.height = curdata->h;

            ret = vc_dispmanx_element_change_attributes(
                update,
                curdata->element,
                0,
                0,
                0,
                &dst_rect,
                &src_rect,
                DISPMANX_NO_HANDLE,
                DISPMANX_NO_ROTATE);
            SDL_assert( ret == DISPMANX_SUCCESS );
            /* Submit asynchronously, otherwise the peformance suffers a lot */
            ret = vc_dispmanx_update_submit( update, 0, NULL );
            SDL_assert( ret == DISPMANX_SUCCESS );
        }
    }   

    return -1;  /* !!! FIXME: this should SDL_SetError() somewhere. */
}
Comment 1 Sam Lantinga 2016-10-01 21:00:21 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/2b008531d078