diff src/video/windib/SDL_dibvideo.c @ 1152:51a8702d8ecd

Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at activekitten.com.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 29 Sep 2005 09:43:00 +0000
parents d31afac94eff
children 86d0d01290ea
line wrap: on
line diff
--- a/src/video/windib/SDL_dibvideo.c	Wed Sep 28 11:36:20 2005 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Thu Sep 29 09:43:00 2005 +0000
@@ -29,9 +29,13 @@
 #include <stdlib.h>
 #include <malloc.h>
 #include <windows.h>
-#if defined(WIN32_PLATFORM_PSPC)
-#include <aygshell.h>                      // Add Pocket PC includes
-#pragma comment( lib, "aygshell" )         // Link Pocket PC library
+
+
+#if defined(_WIN32_WCE)
+
+// defined and used in SDL_sysevents.c
+extern HINSTANCE aygshell;
+
 #endif
 
 /* Not yet in the mingw32 cross-compile headers */
@@ -191,7 +195,7 @@
 }
 
 VideoBootStrap WINDIB_bootstrap = {
-	"windib", "Win95/98/NT/2000 GDI",
+	"windib", "Win95/98/NT/2000/CE GDI",
 	DIB_Available, DIB_CreateDevice
 };
 
@@ -389,12 +393,6 @@
 	hdc = GetDC(SDL_Window);
 	depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
 	ReleaseDC(SDL_Window, hdc);
-#ifndef _WIN32_WCE
-	// AFAIK 16 bit CE devices have indeed RGB 565
-	if ( depth == 16 ) {
-		depth = 15;	/* GDI defined as RGB 555 */
-	}
-#endif
 	return(depth);
 #else
     int dib_size;
@@ -518,23 +516,18 @@
 	video->h = height;
 	video->pitch = SDL_CalculatePitch(video);
 
-#ifdef WIN32_PLATFORM_PSPC
-	 /* Stuff to hide that $#!^%#$ WinCE taskbar in fullscreen... */
-	if ( flags & SDL_FULLSCREEN ) {
-		if ( !(prev_flags & SDL_FULLSCREEN) ) {
-			SHFullScreen(SDL_Window, SHFS_HIDETASKBAR);
-			SHFullScreen(SDL_Window, SHFS_HIDESIPBUTTON);
-			ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE);
-		}
+	/* Small fix for WinCE/Win32 - when activating window
+	   SDL_VideoSurface is equal to zero, so activating code
+	   is not called properly for fullscreen windows because
+	   macros WINDIB_FULLSCREEN uses SDL_VideoSurface
+	*/
+	SDL_VideoSurface = video;
+
+#if defined(_WIN32_WCE)
+	if ( flags & SDL_FULLSCREEN )
 		video->flags |= SDL_FULLSCREEN;
-	} else {
-		if ( prev_flags & SDL_FULLSCREEN ) {
-			SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR);
-			SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON);
-			ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL);
-		}
-	}
 #endif
+
 #ifndef NO_CHANGEDISPLAYSETTINGS
 	/* Set fullscreen mode if appropriate */
 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
@@ -942,14 +935,6 @@
 	if ( SDL_Window ) {
 		/* Delete the screen bitmap (also frees screen->pixels) */
 		if ( this->screen ) {
-#ifdef WIN32_PLATFORM_PSPC
-			if ( this->screen->flags & SDL_FULLSCREEN ) {
-				/* Unhide taskbar, etc. */
-				SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR);
-				SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON);
-				ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL);
-			}
-#endif
 #ifndef NO_CHANGEDISPLAYSETTINGS
 			if ( this->screen->flags & SDL_FULLSCREEN ) {
 				ChangeDisplaySettings(NULL, 0);
@@ -975,6 +960,17 @@
 		FlushMessageQueue();
 
 		SDL_Window = NULL;
+
+#if defined(_WIN32_WCE)
+
+// Unload wince aygshell library to prevent leak
+		if( aygshell ) 
+		{
+			FreeLibrary(aygshell);
+			aygshell = NULL;
+		}
+#endif
+
 	}
 }