Restore and save menu bar when entering and exiting fullscreen mode
authorPatrice Mandin <patmandin@gmail.com>
Mon, 06 Jun 2005 10:27:22 +0000
changeset 10698b1c83edcde2
parent 1068 adb547913775
child 1070 75e8378103a9
Restore and save menu bar when entering and exiting fullscreen mode
src/video/gem/SDL_gemvideo.c
src/video/gem/SDL_gemvideo.h
     1.1 --- a/src/video/gem/SDL_gemvideo.c	Mon Jun 06 10:26:40 2005 +0000
     1.2 +++ b/src/video/gem/SDL_gemvideo.c	Mon Jun 06 10:27:22 2005 +0000
     1.3 @@ -443,6 +443,10 @@
     1.4  	vsf_interior(VDI_handle,1);
     1.5  	vsf_perimeter(VDI_handle,0);
     1.6  
     1.7 +	/* Menu bar save buffer */
     1.8 +	menubar_size = GEM_desk_w * GEM_desk_y * VDI_pixelsize;
     1.9 +	GEM_menubar=Atari_SysMalloc(menubar_size,MX_PREFTTRAM);
    1.10 +
    1.11  	/* Fill video modes list */
    1.12  	SDL_modelist[0] = malloc(sizeof(SDL_Rect));
    1.13  	SDL_modelist[0]->x = 0;
    1.14 @@ -525,6 +529,29 @@
    1.15  		/* Reserve memory space, used to be sure of compatibility */
    1.16  		form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
    1.17  
    1.18 +		/* Save menu bar */
    1.19 +		if (GEM_menubar) {
    1.20 +			MFDB mfdb_src;
    1.21 +			short blitcoords[8];
    1.22 +
    1.23 +			mfdb_src.fd_addr=GEM_menubar;
    1.24 +			mfdb_src.fd_w=GEM_desk_w;
    1.25 +			mfdb_src.fd_h=GEM_desk_y;
    1.26 +			mfdb_src.fd_wdwidth= (GEM_desk_w*VDI_pixelsize) >> 4;
    1.27 +			mfdb_src.fd_nplanes=VDI_bpp;
    1.28 +			mfdb_src.fd_stand=
    1.29 +				mfdb_src.fd_r1=
    1.30 +				mfdb_src.fd_r2=
    1.31 +				mfdb_src.fd_r3= 0;
    1.32 +
    1.33 +			blitcoords[0] = blitcoords[4] = 0;
    1.34 +			blitcoords[1] = blitcoords[5] = 0;
    1.35 +			blitcoords[2] = blitcoords[6] = GEM_desk_w-1;
    1.36 +			blitcoords[3] = blitcoords[7] = GEM_desk_y-1;
    1.37 +
    1.38 +			vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &VDI_dst_mfdb, &mfdb_src);
    1.39 +		}
    1.40 +
    1.41  		GEM_locked=SDL_TRUE;
    1.42  	}
    1.43  }
    1.44 @@ -532,6 +559,29 @@
    1.45  static void GEM_UnlockScreen(_THIS)
    1.46  {
    1.47  	if (GEM_locked) {
    1.48 +		/* Restore menu bar */
    1.49 +		if (GEM_menubar) {
    1.50 +			MFDB mfdb_src;
    1.51 +			short blitcoords[8];
    1.52 +
    1.53 +			mfdb_src.fd_addr=GEM_menubar;
    1.54 +			mfdb_src.fd_w=GEM_desk_w;
    1.55 +			mfdb_src.fd_h=GEM_desk_y;
    1.56 +			mfdb_src.fd_wdwidth= (GEM_desk_w*VDI_pixelsize) >> 4;
    1.57 +			mfdb_src.fd_nplanes=VDI_bpp;
    1.58 +			mfdb_src.fd_stand=
    1.59 +				mfdb_src.fd_r1=
    1.60 +				mfdb_src.fd_r2=
    1.61 +				mfdb_src.fd_r3= 0;
    1.62 +
    1.63 +			blitcoords[0] = blitcoords[4] = 0;
    1.64 +			blitcoords[1] = blitcoords[5] = 0;
    1.65 +			blitcoords[2] = blitcoords[6] = GEM_desk_w-1;
    1.66 +			blitcoords[3] = blitcoords[7] = GEM_desk_y-1;
    1.67 +
    1.68 +			vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
    1.69 +		}
    1.70 +
    1.71  		/* Restore screen memory, and send REDRAW to all apps */
    1.72  		form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
    1.73  		/* Unlock AES */
    1.74 @@ -1068,6 +1118,10 @@
    1.75  	}
    1.76  
    1.77  	GEM_UnlockScreen(this);
    1.78 +	if (GEM_menubar) {
    1.79 +		Mfree(GEM_menubar);
    1.80 +		GEM_menubar=NULL;
    1.81 +	}
    1.82  
    1.83  	appl_exit();
    1.84  
     2.1 --- a/src/video/gem/SDL_gemvideo.h	Mon Jun 06 10:26:40 2005 +0000
     2.2 +++ b/src/video/gem/SDL_gemvideo.h	Mon Jun 06 10:27:22 2005 +0000
     2.3 @@ -81,6 +81,7 @@
     2.4  	SDL_bool locked;			/* AES locked for fullscreen ? */
     2.5  	SDL_bool lock_redraw;		/* Prevent redraw till buffers are setup */
     2.6  	short message[8];			/* To self-send an AES message */
     2.7 +	void *menubar;				/* Menu bar save buffer when going fullscreen */
     2.8  
     2.9  	SDL_bool fullscreen;		/* Fullscreen or windowed mode ? */
    2.10  	SDL_Rect *SDL_modelist[SDL_NUMMODES+1];	/* Mode list */
    2.11 @@ -126,6 +127,7 @@
    2.12  #define SDL_modelist		(this->hidden->SDL_modelist)
    2.13  #define GEM_icon			(this->hidden->icon)
    2.14  #define GEM_fullscreen		(this->hidden->fullscreen)
    2.15 +#define GEM_menubar			(this->hidden->menubar)
    2.16  
    2.17  #define GEM_buffer1			(this->hidden->buffer1)
    2.18  #define GEM_buffer2			(this->hidden->buffer2)