mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-22 01:57:18 +01:00
Fixed bug changing cursors on Raspberry Pi
This commit is contained in:
parent
3f0d520a49
commit
aea483577a
@ -51,6 +51,8 @@ static void RPI_FreeCursor(SDL_Cursor * cursor);
|
|||||||
static void RPI_WarpMouse(SDL_Window * window, int x, int y);
|
static void RPI_WarpMouse(SDL_Window * window, int x, int y);
|
||||||
static int RPI_WarpMouseGlobal(int x, int y);
|
static int RPI_WarpMouseGlobal(int x, int y);
|
||||||
|
|
||||||
|
static SDL_Cursor *global_cursor;
|
||||||
|
|
||||||
static SDL_Cursor *
|
static SDL_Cursor *
|
||||||
RPI_CreateDefaultCursor(void)
|
RPI_CreateDefaultCursor(void)
|
||||||
{
|
{
|
||||||
@ -126,13 +128,14 @@ RPI_ShowCursor(SDL_Cursor * cursor)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor == NULL) {
|
if (cursor == global_cursor) {
|
||||||
/* FIXME: We hide the current mouse's cursor, what we actually need is *_HideCursor */
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
|
if (global_cursor != NULL) {
|
||||||
curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
|
curdata = (RPI_CursorData *) global_cursor->driverdata;
|
||||||
if (curdata->element > DISPMANX_NO_HANDLE) {
|
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
|
||||||
update = vc_dispmanx_update_start(10);
|
update = vc_dispmanx_update_start(0);
|
||||||
SDL_assert(update);
|
SDL_assert(update);
|
||||||
ret = vc_dispmanx_element_remove(update, curdata->element);
|
ret = vc_dispmanx_element_remove(update, curdata->element);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
@ -141,6 +144,9 @@ RPI_ShowCursor(SDL_Cursor * cursor)
|
|||||||
curdata->element = DISPMANX_NO_HANDLE;
|
curdata->element = DISPMANX_NO_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
global_cursor = cursor;
|
||||||
|
|
||||||
|
if (cursor == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +173,7 @@ RPI_ShowCursor(SDL_Cursor * cursor)
|
|||||||
vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
|
vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
|
||||||
vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h);
|
vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h);
|
||||||
|
|
||||||
update = vc_dispmanx_update_start(10);
|
update = vc_dispmanx_update_start(0);
|
||||||
SDL_assert(update);
|
SDL_assert(update);
|
||||||
|
|
||||||
env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER);
|
env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER);
|
||||||
@ -206,7 +212,7 @@ RPI_FreeCursor(SDL_Cursor * cursor)
|
|||||||
|
|
||||||
if (curdata != NULL) {
|
if (curdata != NULL) {
|
||||||
if (curdata->element != DISPMANX_NO_HANDLE) {
|
if (curdata->element != DISPMANX_NO_HANDLE) {
|
||||||
update = vc_dispmanx_update_start(10);
|
update = vc_dispmanx_update_start(0);
|
||||||
SDL_assert(update);
|
SDL_assert(update);
|
||||||
ret = vc_dispmanx_element_remove(update, curdata->element);
|
ret = vc_dispmanx_element_remove(update, curdata->element);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
@ -255,7 +261,7 @@ RPI_WarpMouseGlobal(int x, int y)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
update = vc_dispmanx_update_start(10);
|
update = vc_dispmanx_update_start(0);
|
||||||
if (!update) {
|
if (!update) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -311,7 +317,7 @@ RPI_WarpMouseGlobalGraphicOnly(int x, int y)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
update = vc_dispmanx_update_start(10);
|
update = vc_dispmanx_update_start(0);
|
||||||
if (!update) {
|
if (!update) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -368,7 +374,6 @@ RPI_InitMouse(_THIS)
|
|||||||
void
|
void
|
||||||
RPI_QuitMouse(_THIS)
|
RPI_QuitMouse(_THIS)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is called when a mouse motion event occurs */
|
/* This is called when a mouse motion event occurs */
|
||||||
|
Loading…
Reference in New Issue
Block a user