X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=74123228f2b2185f43100f4c3b2d5c19b70f356a;hb=80b3b0a5109b5678a9a921fcd1b4f7046e5e76d0;hp=18e384c5e13530a60fb75db743059714e5f902b6;hpb=e57078603232563176d90bb543ce2bc3a15b889e;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 18e384c5..74123228 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -26,9 +26,9 @@ /* functions from SGE library */ inline void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32); -#ifdef PLATFORM_WIN32 +/* #ifdef PLATFORM_WIN32 */ #define FULLSCREEN_BUG -#endif +/* #endif */ /* stuff needed to work around SDL/Windows fullscreen drawing bug */ static int fullscreen_width; @@ -866,6 +866,14 @@ void sge_LineRGB(SDL_Surface *Surface, Sint16 x1, Sint16 y1, Sint16 x2, inline void SDLPutPixel(Bitmap *dst_bitmap, int x, int y, Pixel pixel) { +#ifdef FULLSCREEN_BUG + if (dst_bitmap == backbuffer || dst_bitmap == window) + { + x += video_xoffset; + y += video_yoffset; + } +#endif + sge_PutPixel(dst_bitmap->surface, x, y, pixel); } @@ -1269,19 +1277,26 @@ static SDL_Cursor *create_cursor(struct MouseCursorInfo *cursor_info) void SDLSetMouseCursor(struct MouseCursorInfo *cursor_info) { static struct MouseCursorInfo *last_cursor_info = NULL; + static struct MouseCursorInfo *last_cursor_info2 = NULL; static SDL_Cursor *cursor_default = NULL; static SDL_Cursor *cursor_current = NULL; + /* if invoked for the first time, store the SDL default cursor */ if (cursor_default == NULL) cursor_default = SDL_GetCursor(); + /* only create new cursor if cursor info (custom only) has changed */ if (cursor_info != NULL && cursor_info != last_cursor_info) { cursor_current = create_cursor(cursor_info); last_cursor_info = cursor_info; } - SDL_SetCursor(cursor_info ? cursor_current : cursor_default); + /* only set new cursor if cursor info (custom or NULL) has changed */ + if (cursor_info != last_cursor_info2) + SDL_SetCursor(cursor_info ? cursor_current : cursor_default); + + last_cursor_info2 = cursor_info; } @@ -1354,14 +1369,14 @@ inline void SDLNextEvent(Event *event) } else if (event->type == EVENT_MOTIONNOTIFY) { - if (((ButtonEvent *)event)->x > video_xoffset) - ((ButtonEvent *)event)->x -= video_xoffset; + if (((MotionEvent *)event)->x > video_xoffset) + ((MotionEvent *)event)->x -= video_xoffset; else - ((ButtonEvent *)event)->x = 0; - if (((ButtonEvent *)event)->y > video_yoffset) - ((ButtonEvent *)event)->y -= video_yoffset; + ((MotionEvent *)event)->x = 0; + if (((MotionEvent *)event)->y > video_yoffset) + ((MotionEvent *)event)->y -= video_yoffset; else - ((ButtonEvent *)event)->y = 0; + ((MotionEvent *)event)->y = 0; } #endif }