Commit fef7027b authored by Sam Lantinga's avatar Sam Lantinga

Fixed mouse warp position bug with offset video modes

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40528
parent b749b25a
...@@ -295,13 +295,15 @@ void SDL_WarpMouse (Uint16 x, Uint16 y) ...@@ -295,13 +295,15 @@ void SDL_WarpMouse (Uint16 x, Uint16 y)
SDL_VideoDevice *video = current_video; SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = 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 */ /* This generates a mouse motion event */
if ( video->WarpWMCursor ) { if ( video->WarpWMCursor ) {
video->WarpWMCursor(this, x, y); video->WarpWMCursor(this, x, y);
} else { } 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); SDL_PrivateMouseMotion(0, 0, x, y);
} }
} }
......
...@@ -58,9 +58,6 @@ int VGL_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -58,9 +58,6 @@ int VGL_ShowWMCursor(_THIS, WMcursor *cursor)
void VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y) 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); SDL_PrivateMouseMotion(0, 0, x, y);
} }
...@@ -213,12 +213,7 @@ int WIN_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -213,12 +213,7 @@ int WIN_ShowWMCursor(_THIS, WMcursor *cursor)
void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y) void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{ {
POINT pt;
if ( DDRAW_FULLSCREEN() ) { 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); SDL_PrivateMouseMotion(0, 0, x, y);
} else if ( mouse_relative) { } else if ( mouse_relative) {
/* RJR: March 28, 2000 /* RJR: March 28, 2000
...@@ -226,6 +221,7 @@ void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y) ...@@ -226,6 +221,7 @@ void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
mouse hidden and grabbed */ mouse hidden and grabbed */
SDL_PrivateMouseMotion(0, 0, x, y); SDL_PrivateMouseMotion(0, 0, x, y);
} else { } else {
POINT pt;
pt.x = x; pt.x = x;
pt.y = y; pt.y = y;
ClientToScreen(SDL_Window, &pt); ClientToScreen(SDL_Window, &pt);
......
...@@ -177,9 +177,11 @@ int X11_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -177,9 +177,11 @@ int X11_ShowWMCursor(_THIS, WMcursor *cursor)
void X11_WarpWMCursor(_THIS, Uint16 x, Uint16 y) void X11_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{ {
if ( using_dga & DGA_MOUSE ) { if ( using_dga & DGA_MOUSE ) {
x += (this->screen->offset % this->screen->pitch) / SDL_PrivateMouseMotion(0, 0, x, y);
this->screen->format->BytesPerPixel; } else if ( mouse_relative) {
y += (this->screen->offset / this->screen->pitch); /* RJR: March 28, 2000
leave physical cursor at center of screen if
mouse hidden and grabbed */
SDL_PrivateMouseMotion(0, 0, x, y); SDL_PrivateMouseMotion(0, 0, x, y);
} else { } else {
SDL_Lock_EventThread(); SDL_Lock_EventThread();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment