# HG changeset patch # User Sam Lantinga # Date 1034323766 0 # Node ID 5c74ac14735821962f8d0586f14827f59c1ed719 # Parent 4314a501d7bef2dd1122445572b5c4b8841a3491 Fixed mouse warp position bug with offset video modes diff -r 4314a501d7be -r 5c74ac147358 src/video/SDL_cursor.c --- a/src/video/SDL_cursor.c Fri Oct 11 07:56:36 2002 +0000 +++ b/src/video/SDL_cursor.c Fri Oct 11 08:09:26 2002 +0000 @@ -295,13 +295,15 @@ SDL_VideoDevice *video = current_video; SDL_VideoDevice *this = current_video; + /* If we have an offset video mode, offset the mouse coordinates */ + x += (this->screen->offset % this->screen->pitch) / + this->screen->format->BytesPerPixel; + y += (this->screen->offset / this->screen->pitch); + /* This generates a mouse motion event */ if ( video->WarpWMCursor ) { video->WarpWMCursor(this, x, y); } else { - x += (this->screen->offset % this->screen->pitch) / - this->screen->format->BytesPerPixel; - y += (this->screen->offset / this->screen->pitch); SDL_PrivateMouseMotion(0, 0, x, y); } } diff -r 4314a501d7be -r 5c74ac147358 src/video/vgl/SDL_vglmouse.c --- a/src/video/vgl/SDL_vglmouse.c Fri Oct 11 07:56:36 2002 +0000 +++ b/src/video/vgl/SDL_vglmouse.c Fri Oct 11 08:09:26 2002 +0000 @@ -58,9 +58,6 @@ void VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y) { - x += (this->screen->offset % this->screen->pitch) / - this->screen->format->BytesPerPixel; - y += (this->screen->offset / this->screen->pitch); SDL_PrivateMouseMotion(0, 0, x, y); } diff -r 4314a501d7be -r 5c74ac147358 src/video/wincommon/SDL_sysmouse.c --- a/src/video/wincommon/SDL_sysmouse.c Fri Oct 11 07:56:36 2002 +0000 +++ b/src/video/wincommon/SDL_sysmouse.c Fri Oct 11 08:09:26 2002 +0000 @@ -213,12 +213,7 @@ void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y) { - POINT pt; - if ( DDRAW_FULLSCREEN() ) { - x += (this->screen->offset % this->screen->pitch) / - this->screen->format->BytesPerPixel; - y += (this->screen->offset / this->screen->pitch); SDL_PrivateMouseMotion(0, 0, x, y); } else if ( mouse_relative) { /* RJR: March 28, 2000 @@ -226,6 +221,7 @@ mouse hidden and grabbed */ SDL_PrivateMouseMotion(0, 0, x, y); } else { + POINT pt; pt.x = x; pt.y = y; ClientToScreen(SDL_Window, &pt); diff -r 4314a501d7be -r 5c74ac147358 src/video/x11/SDL_x11mouse.c --- a/src/video/x11/SDL_x11mouse.c Fri Oct 11 07:56:36 2002 +0000 +++ b/src/video/x11/SDL_x11mouse.c Fri Oct 11 08:09:26 2002 +0000 @@ -177,9 +177,11 @@ void X11_WarpWMCursor(_THIS, Uint16 x, Uint16 y) { if ( using_dga & DGA_MOUSE ) { - x += (this->screen->offset % this->screen->pitch) / - this->screen->format->BytesPerPixel; - y += (this->screen->offset / this->screen->pitch); + SDL_PrivateMouseMotion(0, 0, x, y); + } else if ( mouse_relative) { + /* RJR: March 28, 2000 + leave physical cursor at center of screen if + mouse hidden and grabbed */ SDL_PrivateMouseMotion(0, 0, x, y); } else { SDL_Lock_EventThread();