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 1069 8b1c83edcde2
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
--- a/src/video/gem/SDL_gemvideo.c	Mon Jun 06 10:26:40 2005 +0000
+++ b/src/video/gem/SDL_gemvideo.c	Mon Jun 06 10:27:22 2005 +0000
@@ -443,6 +443,10 @@
 	vsf_interior(VDI_handle,1);
 	vsf_perimeter(VDI_handle,0);
 
+	/* Menu bar save buffer */
+	menubar_size = GEM_desk_w * GEM_desk_y * VDI_pixelsize;
+	GEM_menubar=Atari_SysMalloc(menubar_size,MX_PREFTTRAM);
+
 	/* Fill video modes list */
 	SDL_modelist[0] = malloc(sizeof(SDL_Rect));
 	SDL_modelist[0]->x = 0;
@@ -525,6 +529,29 @@
 		/* Reserve memory space, used to be sure of compatibility */
 		form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
 
+		/* Save menu bar */
+		if (GEM_menubar) {
+			MFDB mfdb_src;
+			short blitcoords[8];
+
+			mfdb_src.fd_addr=GEM_menubar;
+			mfdb_src.fd_w=GEM_desk_w;
+			mfdb_src.fd_h=GEM_desk_y;
+			mfdb_src.fd_wdwidth= (GEM_desk_w*VDI_pixelsize) >> 4;
+			mfdb_src.fd_nplanes=VDI_bpp;
+			mfdb_src.fd_stand=
+				mfdb_src.fd_r1=
+				mfdb_src.fd_r2=
+				mfdb_src.fd_r3= 0;
+
+			blitcoords[0] = blitcoords[4] = 0;
+			blitcoords[1] = blitcoords[5] = 0;
+			blitcoords[2] = blitcoords[6] = GEM_desk_w-1;
+			blitcoords[3] = blitcoords[7] = GEM_desk_y-1;
+
+			vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &VDI_dst_mfdb, &mfdb_src);
+		}
+
 		GEM_locked=SDL_TRUE;
 	}
 }
@@ -532,6 +559,29 @@
 static void GEM_UnlockScreen(_THIS)
 {
 	if (GEM_locked) {
+		/* Restore menu bar */
+		if (GEM_menubar) {
+			MFDB mfdb_src;
+			short blitcoords[8];
+
+			mfdb_src.fd_addr=GEM_menubar;
+			mfdb_src.fd_w=GEM_desk_w;
+			mfdb_src.fd_h=GEM_desk_y;
+			mfdb_src.fd_wdwidth= (GEM_desk_w*VDI_pixelsize) >> 4;
+			mfdb_src.fd_nplanes=VDI_bpp;
+			mfdb_src.fd_stand=
+				mfdb_src.fd_r1=
+				mfdb_src.fd_r2=
+				mfdb_src.fd_r3= 0;
+
+			blitcoords[0] = blitcoords[4] = 0;
+			blitcoords[1] = blitcoords[5] = 0;
+			blitcoords[2] = blitcoords[6] = GEM_desk_w-1;
+			blitcoords[3] = blitcoords[7] = GEM_desk_y-1;
+
+			vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
+		}
+
 		/* Restore screen memory, and send REDRAW to all apps */
 		form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
 		/* Unlock AES */
@@ -1068,6 +1118,10 @@
 	}
 
 	GEM_UnlockScreen(this);
+	if (GEM_menubar) {
+		Mfree(GEM_menubar);
+		GEM_menubar=NULL;
+	}
 
 	appl_exit();
 
--- a/src/video/gem/SDL_gemvideo.h	Mon Jun 06 10:26:40 2005 +0000
+++ b/src/video/gem/SDL_gemvideo.h	Mon Jun 06 10:27:22 2005 +0000
@@ -81,6 +81,7 @@
 	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 */
+	void *menubar;				/* Menu bar save buffer when going fullscreen */
 
 	SDL_bool fullscreen;		/* Fullscreen or windowed mode ? */
 	SDL_Rect *SDL_modelist[SDL_NUMMODES+1];	/* Mode list */
@@ -126,6 +127,7 @@
 #define SDL_modelist		(this->hidden->SDL_modelist)
 #define GEM_icon			(this->hidden->icon)
 #define GEM_fullscreen		(this->hidden->fullscreen)
+#define GEM_menubar			(this->hidden->menubar)
 
 #define GEM_buffer1			(this->hidden->buffer1)
 #define GEM_buffer2			(this->hidden->buffer2)