src/video/windib/SDL_dibvideo.c
changeset 1152 51a8702d8ecd
parent 1145 d31afac94eff
child 1251 86d0d01290ea
equal deleted inserted replaced
1151:be9c9c8f6d53 1152:51a8702d8ecd
    27 
    27 
    28 #include <stdio.h>
    28 #include <stdio.h>
    29 #include <stdlib.h>
    29 #include <stdlib.h>
    30 #include <malloc.h>
    30 #include <malloc.h>
    31 #include <windows.h>
    31 #include <windows.h>
    32 #if defined(WIN32_PLATFORM_PSPC)
    32 
    33 #include <aygshell.h>                      // Add Pocket PC includes
    33 
    34 #pragma comment( lib, "aygshell" )         // Link Pocket PC library
    34 #if defined(_WIN32_WCE)
       
    35 
       
    36 // defined and used in SDL_sysevents.c
       
    37 extern HINSTANCE aygshell;
       
    38 
    35 #endif
    39 #endif
    36 
    40 
    37 /* Not yet in the mingw32 cross-compile headers */
    41 /* Not yet in the mingw32 cross-compile headers */
    38 #ifndef CDS_FULLSCREEN
    42 #ifndef CDS_FULLSCREEN
    39 #define CDS_FULLSCREEN	4
    43 #define CDS_FULLSCREEN	4
   189 	/* We're finally ready */
   193 	/* We're finally ready */
   190 	return device;
   194 	return device;
   191 }
   195 }
   192 
   196 
   193 VideoBootStrap WINDIB_bootstrap = {
   197 VideoBootStrap WINDIB_bootstrap = {
   194 	"windib", "Win95/98/NT/2000 GDI",
   198 	"windib", "Win95/98/NT/2000/CE GDI",
   195 	DIB_Available, DIB_CreateDevice
   199 	DIB_Available, DIB_CreateDevice
   196 };
   200 };
   197 
   201 
   198 #ifndef NO_CHANGEDISPLAYSETTINGS
   202 #ifndef NO_CHANGEDISPLAYSETTINGS
   199 
   203 
   387 	HDC hdc;
   391 	HDC hdc;
   388 
   392 
   389 	hdc = GetDC(SDL_Window);
   393 	hdc = GetDC(SDL_Window);
   390 	depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
   394 	depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
   391 	ReleaseDC(SDL_Window, hdc);
   395 	ReleaseDC(SDL_Window, hdc);
   392 #ifndef _WIN32_WCE
       
   393 	// AFAIK 16 bit CE devices have indeed RGB 565
       
   394 	if ( depth == 16 ) {
       
   395 		depth = 15;	/* GDI defined as RGB 555 */
       
   396 	}
       
   397 #endif
       
   398 	return(depth);
   396 	return(depth);
   399 #else
   397 #else
   400     int dib_size;
   398     int dib_size;
   401     LPBITMAPINFOHEADER dib_hdr;
   399     LPBITMAPINFOHEADER dib_hdr;
   402     HDC hdc;
   400     HDC hdc;
   516 	video->flags = 0;	/* Clear flags */
   514 	video->flags = 0;	/* Clear flags */
   517 	video->w = width;
   515 	video->w = width;
   518 	video->h = height;
   516 	video->h = height;
   519 	video->pitch = SDL_CalculatePitch(video);
   517 	video->pitch = SDL_CalculatePitch(video);
   520 
   518 
   521 #ifdef WIN32_PLATFORM_PSPC
   519 	/* Small fix for WinCE/Win32 - when activating window
   522 	 /* Stuff to hide that $#!^%#$ WinCE taskbar in fullscreen... */
   520 	   SDL_VideoSurface is equal to zero, so activating code
   523 	if ( flags & SDL_FULLSCREEN ) {
   521 	   is not called properly for fullscreen windows because
   524 		if ( !(prev_flags & SDL_FULLSCREEN) ) {
   522 	   macros WINDIB_FULLSCREEN uses SDL_VideoSurface
   525 			SHFullScreen(SDL_Window, SHFS_HIDETASKBAR);
   523 	*/
   526 			SHFullScreen(SDL_Window, SHFS_HIDESIPBUTTON);
   524 	SDL_VideoSurface = video;
   527 			ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE);
   525 
   528 		}
   526 #if defined(_WIN32_WCE)
       
   527 	if ( flags & SDL_FULLSCREEN )
   529 		video->flags |= SDL_FULLSCREEN;
   528 		video->flags |= SDL_FULLSCREEN;
   530 	} else {
   529 #endif
   531 		if ( prev_flags & SDL_FULLSCREEN ) {
   530 
   532 			SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR);
       
   533 			SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON);
       
   534 			ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL);
       
   535 		}
       
   536 	}
       
   537 #endif
       
   538 #ifndef NO_CHANGEDISPLAYSETTINGS
   531 #ifndef NO_CHANGEDISPLAYSETTINGS
   539 	/* Set fullscreen mode if appropriate */
   532 	/* Set fullscreen mode if appropriate */
   540 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
   533 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
   541 		DEVMODE settings;
   534 		DEVMODE settings;
   542 
   535 
   940 {
   933 {
   941 	/* Destroy the window and everything associated with it */
   934 	/* Destroy the window and everything associated with it */
   942 	if ( SDL_Window ) {
   935 	if ( SDL_Window ) {
   943 		/* Delete the screen bitmap (also frees screen->pixels) */
   936 		/* Delete the screen bitmap (also frees screen->pixels) */
   944 		if ( this->screen ) {
   937 		if ( this->screen ) {
   945 #ifdef WIN32_PLATFORM_PSPC
       
   946 			if ( this->screen->flags & SDL_FULLSCREEN ) {
       
   947 				/* Unhide taskbar, etc. */
       
   948 				SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR);
       
   949 				SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON);
       
   950 				ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL);
       
   951 			}
       
   952 #endif
       
   953 #ifndef NO_CHANGEDISPLAYSETTINGS
   938 #ifndef NO_CHANGEDISPLAYSETTINGS
   954 			if ( this->screen->flags & SDL_FULLSCREEN ) {
   939 			if ( this->screen->flags & SDL_FULLSCREEN ) {
   955 				ChangeDisplaySettings(NULL, 0);
   940 				ChangeDisplaySettings(NULL, 0);
   956 				ShowWindow(SDL_Window, SW_HIDE);
   941 				ShowWindow(SDL_Window, SW_HIDE);
   957 			}
   942 			}
   973 		DIB_DestroyWindow(this);
   958 		DIB_DestroyWindow(this);
   974 		SDL_UnregisterApp();
   959 		SDL_UnregisterApp();
   975 		FlushMessageQueue();
   960 		FlushMessageQueue();
   976 
   961 
   977 		SDL_Window = NULL;
   962 		SDL_Window = NULL;
       
   963 
       
   964 #if defined(_WIN32_WCE)
       
   965 
       
   966 // Unload wince aygshell library to prevent leak
       
   967 		if( aygshell ) 
       
   968 		{
       
   969 			FreeLibrary(aygshell);
       
   970 			aygshell = NULL;
       
   971 		}
       
   972 #endif
       
   973 
   978 	}
   974 	}
   979 }
   975 }
   980 
   976 
   981 /* Exported for the windows message loop only */
   977 /* Exported for the windows message loop only */
   982 static void DIB_FocusPalette(_THIS, int foreground)
   978 static void DIB_FocusPalette(_THIS, int foreground)