diff src/video/win32/SDL_win32modes.c @ 3097:0d12e8f1de3c

Date: Thu, 05 Feb 2009 18:07:35 +0100 From: Stefan Klug Subject: [SDL] SDL 1.3 WinCE backend as promised, I've started to work on the WinCE backend of SDL 1.3 I've modified the win32 video backend and the gdi renderer, to work properly in WinCE. The results till now are great, but there is still some work to do. Attached are two patches with my changes. I would be happy if someone could review and propably commit them. The first one (configure.in.patch) should be straight forward without any side effects. The second one does the necessary changes to the win32 backend. I was really unhappy to start slicing this shiny new backend with #ifdef/#endif but I saw no other option. The most problematic issues are: - WinCe has no GetDIBits, so its practically impossible to fill a BITMAPINFO with correct values. I therefore removed the bmi member from the GDI_RenderData in SDL_gdirender.c to prevent usage of a not or not properly initialized bmi. - In SDL_win32window.c I exchanged some ASCII function by their general counterparts, (In CE only the Unicode versions are available). I don't know if this has a negative effect when running in win32 Cheers Stefan
author Sam Lantinga <slouken@libsdl.org>
date Mon, 23 Mar 2009 05:35:21 +0000
parents 99210400e8b9
children 7f684f249ec9
line wrap: on
line diff
--- a/src/video/win32/SDL_win32modes.c	Mon Mar 23 05:21:40 2009 +0000
+++ b/src/video/win32/SDL_win32modes.c	Mon Mar 23 05:35:21 2009 +0000
@@ -53,7 +53,17 @@
     mode->h = devmode.dmPelsHeight;
     mode->refresh_rate = devmode.dmDisplayFrequency;
     mode->driverdata = data;
+#ifdef _WIN32_WCE
+    /* In WinCE EnumDisplaySettings(ENUM_CURRENT_SETTINGS) doesn't take the user defined orientation
+     into account but GetSystemMetrixs does. */
+    if(index == ENUM_CURRENT_SETTINGS) {
+    	mode->w = GetSystemMetrics(SM_CXSCREEN);
+    	mode->h = GetSystemMetrics(SM_CYSCREEN);
+    }
+#endif
 
+/* WinCE has no GetDIBits, therefore we can't use it to get the display format */
+#ifndef _WIN32_WCE
     if (index == ENUM_CURRENT_SETTINGS
         && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) {
         char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
@@ -87,7 +97,10 @@
         } else if (bmi->bmiHeader.biBitCount == 8) {
             mode->format = SDL_PIXELFORMAT_INDEX8;
         }
-    } else {
+    } else
+#endif /* _WIN32_WCE */
+    {
+
         /* FIXME: Can we tell what this will be? */
         switch (devmode.dmBitsPerPel) {
         case 32:
@@ -198,6 +211,14 @@
 {
     SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
     LONG status;
+    
+#ifdef _WIN32_WCE
+    /* TODO: implement correctly.
+       On my Asus MyPAL, if I execute the code below
+       I get DISP_CHANGE_BADFLAGS and the Titlebar of the fullscreen window stays
+       visible ... (SDL_RaiseWindow() would fix that one)*/ 
+    return 0;
+#endif
 
     status =
         ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL,