diff src/video/x11/SDL_x11modes.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 ee331407574f
children 76f9b76ddf0f
line wrap: on
line diff
--- a/src/video/x11/SDL_x11modes.c	Mon Nov 30 21:04:25 2009 +0000
+++ b/src/video/x11/SDL_x11modes.c	Tue Dec 01 05:57:15 2009 +0000
@@ -311,10 +311,10 @@
 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
 
 void
-X11_GetDisplayModes(_THIS)
+X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
 {
     Display *display = ((SDL_VideoData *) _this->driverdata)->display;
-    SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
+    SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
 #if SDL_VIDEO_DRIVER_X11_XINERAMA
     int xinerama_major, xinerama_minor;
     int screens;
@@ -341,7 +341,7 @@
      * we have to use the same format for all windows and all display modes.
      * (or support recreating the window with a new visual behind the scenes)
      */
-    mode.format = SDL_CurrentDisplay.current_mode.format;
+    mode.format = sdl_display->current_mode.format;
     mode.driverdata = NULL;
 
     data->use_xinerama = 0;
@@ -382,14 +382,14 @@
                 mode.w = screen_w;
                 mode.h = screen_h;
                 mode.refresh_rate = 0;
-                SDL_AddDisplayMode(_this->current_display, &mode);
+                SDL_AddDisplayMode(sdl_display, &mode);
             }
 
             /* Add the head xinerama mode */
             mode.w = data->xinerama_info.width;
             mode.h = data->xinerama_info.height;
             mode.refresh_rate = 0;
-            SDL_AddDisplayMode(_this->current_display, &mode);
+            SDL_AddDisplayMode(sdl_display, &mode);
         }
     }
 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
@@ -426,7 +426,7 @@
                             "XRANDR: mode = %4d[%d], w = %4d, h = %4d, rate = %4d\n",
                             i, j, mode.w, mode.h, mode.refresh_rate);
 #endif
-                    SDL_AddDisplayMode(_this->current_display, &mode);
+                    SDL_AddDisplayMode(sdl_display, &mode);
                 }
             }
 
@@ -462,7 +462,7 @@
             mode.w = modes[i]->hdisplay;
             mode.h = modes[i]->vdisplay;
             mode.refresh_rate = calculate_rate(modes[i]);
-            SDL_AddDisplayMode(_this->current_display, &mode);
+            SDL_AddDisplayMode(sdl_display, &mode);
         }
         XFree(modes);
 
@@ -475,7 +475,7 @@
         mode.w = screen_w;
         mode.h = screen_h;
         mode.refresh_rate = 0;
-        SDL_AddDisplayMode(_this->current_display, &mode);
+        SDL_AddDisplayMode(sdl_display, &mode);
     }
 #ifdef X11MODES_DEBUG
     if (data->use_xinerama) {
@@ -672,10 +672,10 @@
 }
 
 int
-X11_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
+X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode)
 {
     Display *display = ((SDL_VideoData *) _this->driverdata)->display;
-    SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
+    SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
 
     set_best_resolution(display, data, mode->w, mode->h, mode->refresh_rate);
     return 0;