[Video/KMSDRM] Manually re-show the cursor on window creation, if needed.

This commit is contained in:
Manuel Alfayate Corchete 2020-12-21 01:53:11 +01:00
parent 4198f0e52c
commit b06ef3a18c
3 changed files with 34 additions and 2 deletions

View File

@ -179,6 +179,31 @@ cleanup:
return ret;
}
/* When we create a window, we have to test if we have to show the cursor,
and explicily do so if necessary.
This is because when we destroy a window, we take the cursor away from the
cursor plane, and destroy the cusror GBM BO. So we have to re-show it,
so to say. */
void
KMSDRM_InitCursor()
{
SDL_Mouse *mouse = NULL;
mouse = SDL_GetMouse();
if (!mouse) {
return;
}
if (!(mouse->cur_cursor)) {
return;
}
if (!(mouse->cursor_shown)) {
return;
}
KMSDRM_ShowCursor(mouse->cur_cursor);
}
/* Show the specified cursor, or hide if cursor is NULL.
cur_cursor is the current cursor, and cursor is the new cursor.
A cursor is displayed on a display, so we have to add a pointer to dispdata

View File

@ -47,6 +47,8 @@ typedef struct _KMSDRM_CursorData
extern void KMSDRM_InitMouse(_THIS);
extern void KMSDRM_DeinitMouse(_THIS);
extern void KMSDRM_InitCursor();
#endif /* SDL_KMSDRM_mouse_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1748,9 +1748,14 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA);
}
/* Can't init mouse sooner because planes are not ready.
We do it along with the KMSDRM_GBMInit() call, so do this only when GBM is not init. */
/* Can't init mouse stuff sooner cursor plane is not ready. */
KMSDRM_InitMouse(_this);
/* Since we take cursor buffer way from the cursor plane and
destroy the cursor GBM BO when we destroy a window, we must
also manually re-show the cursor on screen, if necessary,
when we create a window. */
KMSDRM_InitCursor();
}
/* Allocate window internal data */