[KMS/DRM] Merge patch for bug #5532: No need to correct cursor position now that all windows are fullscreen. Link: https://bugzilla.libsdl.org/show_bug.cgi?id=5519.

This commit is contained in:
Manuel Alfayate Corchete 2021-02-05 22:16:50 +01:00
parent 538f7ad6b7
commit 59cd46c24a
1 changed files with 5 additions and 12 deletions

View File

@ -349,8 +349,7 @@ cleanup:
void void
KMSDRM_InitCursor() KMSDRM_InitCursor()
{ {
SDL_Mouse *mouse = NULL; SDL_Mouse *mouse = SDL_GetMouse();
mouse = SDL_GetMouse();
if (!mouse || !mouse->cur_cursor || !mouse->cursor_shown) { if (!mouse || !mouse->cur_cursor || !mouse->cursor_shown) {
return; return;
@ -442,14 +441,11 @@ KMSDRM_WarpMouseGlobal(int x, int y)
/* And now update the cursor graphic position on screen. */ /* And now update the cursor graphic position on screen. */
if (dispdata->cursor_bo) { if (dispdata->cursor_bo) {
int drm_fd, screen_y; int drm_fd;
int ret = 0; int ret = 0;
/* Correct the Y coordinate, because DRM mouse coordinates start on screen top. */
screen_y = dispdata->mode.vdisplay - window->h + mouse->y;
drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo)); drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo));
ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, x, screen_y); ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, x, y);
if (ret) { if (ret) {
SDL_SetError("drmModeMoveCursor() failed."); SDL_SetError("drmModeMoveCursor() failed.");
@ -504,7 +500,7 @@ static void
KMSDRM_MoveCursor(SDL_Cursor * cursor) KMSDRM_MoveCursor(SDL_Cursor * cursor)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
int drm_fd, screen_y; int drm_fd;
int ret = 0; int ret = 0;
/* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity! /* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity!
@ -521,10 +517,7 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo)); drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo));
/* Correct the Y coordinate, because DRM mouse coordinates start on screen top. */ ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, mouse->x, mouse->y);
screen_y = dispdata->mode.vdisplay - window->h + mouse->y;
ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, mouse->x, screen_y);
if (ret) { if (ret) {
SDL_SetError("drmModeMoveCursor() failed."); SDL_SetError("drmModeMoveCursor() failed.");