diff src/video/win32/SDL_win32modes.c @ 3500:4b594623401b

Work in progress on multi-display support: * Added display parameter to many internal functions so video modes can be set on displays that aren't the public current one. * The fullscreen mode is associated with fullscreen windows - not displays, so different windows more naturally have a mode associated with them based on their width and height. It's no longer necessary to specify a fullscreen mode, a default one will be picked automatically for fullscreen windows.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 01 Dec 2009 05:57:15 +0000
parents 51750b7a966f
children 76f9b76ddf0f
line wrap: on
line diff
--- a/src/video/win32/SDL_win32modes.c	Mon Nov 30 21:04:25 2009 +0000
+++ b/src/video/win32/SDL_win32modes.c	Tue Dec 01 05:57:15 2009 +0000
@@ -41,7 +41,6 @@
     if (!data) {
         return SDL_FALSE;
     }
-    SDL_memcpy(data->DeviceName, deviceName, sizeof(data->DeviceName));
     data->DeviceMode = devmode;
     data->DeviceMode.dmFields =
         (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY |
@@ -196,9 +195,9 @@
 }
 
 void
-WIN_GetDisplayModes(_THIS)
+WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
 {
-    SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
+    SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
     DWORD i;
     SDL_DisplayMode mode;
 
@@ -207,15 +206,16 @@
             break;
         }
         if (mode.format != SDL_PIXELFORMAT_UNKNOWN)
-            if (!SDL_AddDisplayMode(_this->current_display, &mode)) {
+            if (!SDL_AddDisplayMode(display, &mode)) {
                 SDL_free(mode.driverdata);
             }
     }
 }
 
 int
-WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
+WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
 {
+    SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
     SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
     LONG status;
 
@@ -228,8 +228,8 @@
 #endif
 
     status =
-        ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL,
-                                CDS_FULLSCREEN, NULL);
+        ChangeDisplaySettingsEx(displaydata->DeviceName, &data->DeviceMode,
+                                NULL, CDS_FULLSCREEN, NULL);
     if (status == DISP_CHANGE_SUCCESSFUL) {
         return 0;
     } else {