Commit 957b40a0 authored by Patrice Mandin's avatar Patrice Mandin

Do not destroy window on resize, so we can go back to original size from maximized size

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40926
parent a5687fe0
...@@ -479,13 +479,6 @@ static void GEM_FreeBuffers(_THIS) ...@@ -479,13 +479,6 @@ static void GEM_FreeBuffers(_THIS)
free( GEM_buffer1 ); free( GEM_buffer1 );
GEM_buffer1=NULL; GEM_buffer1=NULL;
} }
/* Destroy window */
if (GEM_handle>=0) {
wind_close(GEM_handle);
wind_delete(GEM_handle);
GEM_handle=-1;
}
} }
static void GEM_ClearRect(_THIS, short *rect) static void GEM_ClearRect(_THIS, short *rect)
...@@ -550,8 +543,6 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -550,8 +543,6 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
Uint32 modeflags, screensize; Uint32 modeflags, screensize;
SDL_bool use_shadow1, use_shadow2; SDL_bool use_shadow1, use_shadow2;
GEM_FreeBuffers(this);
/*--- Verify if asked mode can be used ---*/ /*--- Verify if asked mode can be used ---*/
if (flags & SDL_FULLSCREEN) { if (flags & SDL_FULLSCREEN) {
maxwidth=VDI_w; maxwidth=VDI_w;
...@@ -585,6 +576,8 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -585,6 +576,8 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
#endif #endif
/*--- Allocate shadow buffers if needed, and conversion operations ---*/ /*--- Allocate shadow buffers if needed, and conversion operations ---*/
GEM_FreeBuffers(this);
GEM_bufops=0; GEM_bufops=0;
use_shadow1=use_shadow2=SDL_FALSE; use_shadow1=use_shadow2=SDL_FALSE;
if (VDI_screen && (flags & SDL_FULLSCREEN)) { if (VDI_screen && (flags & SDL_FULLSCREEN)) {
...@@ -633,6 +626,11 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -633,6 +626,11 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
} }
if (flags & SDL_FULLSCREEN) { if (flags & SDL_FULLSCREEN) {
/* Close window if needed */
if (GEM_handle >= 0) {
wind_close(GEM_handle);
}
GEM_LockScreen(this); GEM_LockScreen(this);
GEM_ClearScreen(this); GEM_ClearScreen(this);
...@@ -644,11 +642,13 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -644,11 +642,13 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
modeflags |= SDL_SWSURFACE; modeflags |= SDL_SWSURFACE;
} }
} else { } else {
int old_win_type;
short x2,y2,w2,h2; short x2,y2,w2,h2;
GEM_UnlockScreen(this); GEM_UnlockScreen(this);
/* Set window gadgets */ /* Set window gadgets */
old_win_type = GEM_win_type;
if (!(flags & SDL_NOFRAME)) { if (!(flags & SDL_NOFRAME)) {
GEM_win_type=NAME|MOVER|CLOSER|SMALLER; GEM_win_type=NAME|MOVER|CLOSER|SMALLER;
if (flags & SDL_RESIZABLE) { if (flags & SDL_RESIZABLE) {
...@@ -659,7 +659,12 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -659,7 +659,12 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
GEM_win_type=0; GEM_win_type=0;
modeflags |= SDL_NOFRAME; modeflags |= SDL_NOFRAME;
} }
modeflags |= SDL_SWSURFACE;
/* Recreate window ? only for different widget or non-created window */
if ((old_win_type == GEM_win_type) && (GEM_handle >= 0)) {
wind_get(GEM_handle, WF_CURRXYWH, &x2,&y2,&w2,&h2);
} else {
/* Calculate window size */ /* Calculate window size */
if (!wind_calc(WC_BORDER, GEM_win_type, 0,0,width,height, &x2,&y2,&w2,&h2)) { if (!wind_calc(WC_BORDER, GEM_win_type, 0,0,width,height, &x2,&y2,&w2,&h2)) {
GEM_FreeBuffers(this); GEM_FreeBuffers(this);
...@@ -671,6 +676,12 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -671,6 +676,12 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
x2 = GEM_desk_x+((GEM_desk_w-w2)>>1); x2 = GEM_desk_x+((GEM_desk_w-w2)>>1);
y2 = GEM_desk_y+((GEM_desk_h-h2)>>1); y2 = GEM_desk_y+((GEM_desk_h-h2)>>1);
/* Destroy existing window */
if (GEM_handle >= 0) {
wind_close(GEM_handle);
wind_delete(GEM_handle);
}
/* Create window */ /* Create window */
GEM_handle=wind_create(GEM_win_type, x2,y2,w2,h2); GEM_handle=wind_create(GEM_win_type, x2,y2,w2,h2);
if (GEM_handle<0) { if (GEM_handle<0) {
...@@ -686,11 +697,10 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -686,11 +697,10 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
/* Setup window name */ /* Setup window name */
wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0); wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0);
GEM_refresh_name = SDL_FALSE; GEM_refresh_name = SDL_FALSE;
}
/* Open the window */ /* Open the window */
wind_open(GEM_handle,x2,y2,w2,h2); wind_open(GEM_handle,x2,y2,w2,h2);
modeflags |= SDL_SWSURFACE;
} }
/* Set up the new mode framebuffer */ /* Set up the new mode framebuffer */
...@@ -1006,6 +1016,13 @@ void GEM_VideoQuit(_THIS) ...@@ -1006,6 +1016,13 @@ void GEM_VideoQuit(_THIS)
GEM_FreeBuffers(this); GEM_FreeBuffers(this);
/* Destroy window */
if (GEM_handle>=0) {
wind_close(GEM_handle);
wind_delete(GEM_handle);
GEM_handle=-1;
}
GEM_UnlockScreen(this); GEM_UnlockScreen(this);
appl_exit(); appl_exit();
......
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