[KMS/DRM] Correct small omission on bugfix #5513: y-coord correction has to be done on WarpMouseGlobal, too.

main
Manuel Alfayate Corchete 2021-01-29 23:32:42 +01:00
parent 2cc70ca39e
commit 088fb52579
2 changed files with 12 additions and 7 deletions

View File

@ -442,10 +442,14 @@ KMSDRM_WarpMouseGlobal(int x, int y)
/* And now update the cursor graphic position on screen. */
if (dispdata->cursor_bo) {
int ret, drm_fd;
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, y);
int drm_fd, screen_y;
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));
ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, x, screen_y);
if (ret) {
SDL_SetError("drmModeMoveCursor() failed.");
@ -500,7 +504,8 @@ static void
KMSDRM_MoveCursor(SDL_Cursor * cursor)
{
SDL_Mouse *mouse = SDL_GetMouse();
int drm_fd, ret, screen_y;
int drm_fd, screen_y;
int ret = 0;
/* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity!
That's why we move the cursor graphic ONLY. */

View File

@ -1164,8 +1164,8 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
now that we know this is not a VK window. */
KMSDRM_CreateCursorBO(display);
/* Init mouse (=create and set the default cursor),
now that we know this is not a VK window. */
/* Create and set the default cursor now that we know
this is not a VK window. */
KMSDRM_InitMouse(_this, display);
/* When we destroy a window, we remove the cursor buffer from