comparison 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
comparison
equal deleted inserted replaced
526:4314a501d7be 527:5c74ac147358
293 void SDL_WarpMouse (Uint16 x, Uint16 y) 293 void SDL_WarpMouse (Uint16 x, Uint16 y)
294 { 294 {
295 SDL_VideoDevice *video = current_video; 295 SDL_VideoDevice *video = current_video;
296 SDL_VideoDevice *this = current_video; 296 SDL_VideoDevice *this = current_video;
297 297
298 /* If we have an offset video mode, offset the mouse coordinates */
299 x += (this->screen->offset % this->screen->pitch) /
300 this->screen->format->BytesPerPixel;
301 y += (this->screen->offset / this->screen->pitch);
302
298 /* This generates a mouse motion event */ 303 /* This generates a mouse motion event */
299 if ( video->WarpWMCursor ) { 304 if ( video->WarpWMCursor ) {
300 video->WarpWMCursor(this, x, y); 305 video->WarpWMCursor(this, x, y);
301 } else { 306 } else {
302 x += (this->screen->offset % this->screen->pitch) /
303 this->screen->format->BytesPerPixel;
304 y += (this->screen->offset / this->screen->pitch);
305 SDL_PrivateMouseMotion(0, 0, x, y); 307 SDL_PrivateMouseMotion(0, 0, x, y);
306 } 308 }
307 } 309 }
308 310
309 void SDL_MoveCursor(int x, int y) 311 void SDL_MoveCursor(int x, int y)