changeset 964:d9209754ebee

Prevent redraws till internal buffers are correctly setup
author Patrice Mandin <patmandin@gmail.com>
date Sat, 06 Nov 2004 08:56:23 +0000
parents 92c247cec42d
children b68e551205e9
files src/video/gem/SDL_gemevents.c src/video/gem/SDL_gemvideo.c src/video/gem/SDL_gemvideo.h
diffstat 3 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/gem/SDL_gemevents.c	Sun Oct 31 13:15:33 2004 +0000
+++ b/src/video/gem/SDL_gemevents.c	Sat Nov 06 08:56:23 2004 +0000
@@ -210,7 +210,9 @@
 			SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
 			break;
 		case WM_REDRAW:
-			GEM_wind_redraw(this, message[3],&message[4]);
+			if (!GEM_lock_redraw) {
+				GEM_wind_redraw(this, message[3],&message[4]);
+			}
 			break;
 		case WM_ICONIFY:
 		case WM_ALLICONIFY:
@@ -240,8 +242,9 @@
 			break;
 		case WM_SIZED:
 			wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
+			wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
 			GEM_win_fulled = SDL_FALSE;		/* Cancel maximized flag */
-			wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
+			GEM_lock_redraw = SDL_TRUE;		/* Prevent redraw till buffers resized */
 			SDL_PrivateResize(w2, h2);
 			break;
 		case WM_FULLED:
@@ -260,6 +263,7 @@
 				}
 				wind_set (message[3], WF_CURRXYWH, x, y, w, h);
 				wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
+				GEM_lock_redraw = SDL_TRUE;		/* Prevent redraw till buffers resized */
 				SDL_PrivateResize(w2, h2);
 			}
 			break;
--- a/src/video/gem/SDL_gemvideo.c	Sun Oct 31 13:15:33 2004 +0000
+++ b/src/video/gem/SDL_gemvideo.c	Sat Nov 06 08:56:23 2004 +0000
@@ -401,6 +401,7 @@
 	GEM_locked = SDL_FALSE;
 	GEM_win_fulled = SDL_FALSE;
 	GEM_fullscreen = SDL_FALSE;
+	GEM_lock_redraw = SDL_TRUE;	/* Prevent redraw till buffers are setup */
 
 	VDI_screen = NULL;
 	VDI_pitch = VDI_w * VDI_pixelsize;
@@ -720,6 +721,7 @@
 #endif
 
 	this->UpdateRects = GEM_UpdateRects;
+	GEM_lock_redraw = SDL_FALSE;	/* Enable redraw */
 
 	/* We're done */
 	return(current);
@@ -858,6 +860,10 @@
 {
 	SDL_Surface *surface;
 
+	if (GEM_lock_redraw) {
+		return;
+	}
+
 	surface = this->screen;
 
 	if (surface->flags & SDL_FULLSCREEN) {
@@ -951,6 +957,10 @@
 
 static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface)
 {
+	if (GEM_lock_redraw) {
+		return(0);
+	}
+
 	if (surface->flags & SDL_FULLSCREEN) {
 		return GEM_FlipHWSurfaceFullscreen(this, surface);
 	} else {
--- a/src/video/gem/SDL_gemvideo.h	Sun Oct 31 13:15:33 2004 +0000
+++ b/src/video/gem/SDL_gemvideo.h	Sat Nov 06 08:56:23 2004 +0000
@@ -79,6 +79,7 @@
 	SDL_bool window_fulled;		/* Window maximized ? */
 	SDL_bool mouse_relative;	/* Report relative mouse movement */
 	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 */
 
 	SDL_bool fullscreen;		/* Fullscreen or windowed mode ? */
@@ -120,6 +121,7 @@
 #define GEM_win_fulled		(this->hidden->window_fulled)
 #define GEM_mouse_relative	(this->hidden->mouse_relative)
 #define GEM_locked			(this->hidden->locked)
+#define GEM_lock_redraw		(this->hidden->lock_redraw)
 #define GEM_message			(this->hidden->message)
 #define SDL_modelist		(this->hidden->SDL_modelist)
 #define GEM_icon			(this->hidden->icon)