Commit 8a8ea630 authored by Patrice Mandin's avatar Patrice Mandin

Prevent redraws till internal buffers are correctly setup

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40965
parent 6b8a1232
...@@ -210,7 +210,9 @@ static int do_messages(_THIS, short *message) ...@@ -210,7 +210,9 @@ static int do_messages(_THIS, short *message)
SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
break; break;
case WM_REDRAW: case WM_REDRAW:
if (!GEM_lock_redraw) {
GEM_wind_redraw(this, message[3],&message[4]); GEM_wind_redraw(this, message[3],&message[4]);
}
break; break;
case WM_ICONIFY: case WM_ICONIFY:
case WM_ALLICONIFY: case WM_ALLICONIFY:
...@@ -240,8 +242,9 @@ static int do_messages(_THIS, short *message) ...@@ -240,8 +242,9 @@ static int do_messages(_THIS, short *message)
break; break;
case WM_SIZED: case WM_SIZED:
wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]); wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */
wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */
SDL_PrivateResize(w2, h2); SDL_PrivateResize(w2, h2);
break; break;
case WM_FULLED: case WM_FULLED:
...@@ -260,6 +263,7 @@ static int do_messages(_THIS, short *message) ...@@ -260,6 +263,7 @@ static int do_messages(_THIS, short *message)
} }
wind_set (message[3], WF_CURRXYWH, x, y, w, h); wind_set (message[3], WF_CURRXYWH, x, y, w, h);
wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */
SDL_PrivateResize(w2, h2); SDL_PrivateResize(w2, h2);
} }
break; break;
......
...@@ -401,6 +401,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -401,6 +401,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
GEM_locked = SDL_FALSE; GEM_locked = SDL_FALSE;
GEM_win_fulled = SDL_FALSE; GEM_win_fulled = SDL_FALSE;
GEM_fullscreen = SDL_FALSE; GEM_fullscreen = SDL_FALSE;
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers are setup */
VDI_screen = NULL; VDI_screen = NULL;
VDI_pitch = VDI_w * VDI_pixelsize; VDI_pitch = VDI_w * VDI_pixelsize;
...@@ -720,6 +721,7 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -720,6 +721,7 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
#endif #endif
this->UpdateRects = GEM_UpdateRects; this->UpdateRects = GEM_UpdateRects;
GEM_lock_redraw = SDL_FALSE; /* Enable redraw */
/* We're done */ /* We're done */
return(current); return(current);
...@@ -858,6 +860,10 @@ static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects) ...@@ -858,6 +860,10 @@ static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
{ {
SDL_Surface *surface; SDL_Surface *surface;
if (GEM_lock_redraw) {
return;
}
surface = this->screen; surface = this->screen;
if (surface->flags & SDL_FULLSCREEN) { if (surface->flags & SDL_FULLSCREEN) {
...@@ -951,6 +957,10 @@ static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface) ...@@ -951,6 +957,10 @@ static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface)
static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface) static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface)
{ {
if (GEM_lock_redraw) {
return(0);
}
if (surface->flags & SDL_FULLSCREEN) { if (surface->flags & SDL_FULLSCREEN) {
return GEM_FlipHWSurfaceFullscreen(this, surface); return GEM_FlipHWSurfaceFullscreen(this, surface);
} else { } else {
......
...@@ -79,6 +79,7 @@ struct SDL_PrivateVideoData { ...@@ -79,6 +79,7 @@ struct SDL_PrivateVideoData {
SDL_bool window_fulled; /* Window maximized ? */ SDL_bool window_fulled; /* Window maximized ? */
SDL_bool mouse_relative; /* Report relative mouse movement */ SDL_bool mouse_relative; /* Report relative mouse movement */
SDL_bool locked; /* AES locked for fullscreen ? */ SDL_bool locked; /* AES locked for fullscreen ? */
SDL_bool lock_redraw; /* Prevent redraw till buffers are setup */
short message[8]; /* To self-send an AES message */ short message[8]; /* To self-send an AES message */
SDL_bool fullscreen; /* Fullscreen or windowed mode ? */ SDL_bool fullscreen; /* Fullscreen or windowed mode ? */
...@@ -120,6 +121,7 @@ struct SDL_PrivateVideoData { ...@@ -120,6 +121,7 @@ struct SDL_PrivateVideoData {
#define GEM_win_fulled (this->hidden->window_fulled) #define GEM_win_fulled (this->hidden->window_fulled)
#define GEM_mouse_relative (this->hidden->mouse_relative) #define GEM_mouse_relative (this->hidden->mouse_relative)
#define GEM_locked (this->hidden->locked) #define GEM_locked (this->hidden->locked)
#define GEM_lock_redraw (this->hidden->lock_redraw)
#define GEM_message (this->hidden->message) #define GEM_message (this->hidden->message)
#define SDL_modelist (this->hidden->SDL_modelist) #define SDL_modelist (this->hidden->SDL_modelist)
#define GEM_icon (this->hidden->icon) #define GEM_icon (this->hidden->icon)
......
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