diff src/video/SDL_cursor.c @ 527:5c74ac147358

Fixed mouse warp position bug with offset video modes
author Sam Lantinga <slouken@libsdl.org>
date Fri, 11 Oct 2002 08:09:26 +0000
parents f6ffac90895c
children 591b438ab94a
line wrap: on
line diff
--- 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);
 	}
 }