+inline boolean SetVideoMode(void)
+{
+ boolean success = TRUE;
+
+#ifdef USE_SDL_LIBRARY
+ if (setup.fullscreen && !fullscreen_enabled && fullscreen_available)
+ {
+ /* switch display to fullscreen mode, if available */
+ DrawWindow window_old = window;
+ DrawWindow window_new;
+
+ if ((window_new = SDL_SetVideoMode(WIN_XSIZE, WIN_YSIZE, WIN_SDL_DEPTH,
+ SDL_HWSURFACE|SDL_FULLSCREEN))
+ == NULL)
+ {
+ /* switching display to fullscreen mode failed */
+ Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError());
+
+ /* do not try it again */
+ fullscreen_available = FALSE;
+ success = FALSE;
+ }
+ else
+ {
+ if (window_old)
+ SDL_FreeSurface(window_old);
+ window = window_new;
+
+ fullscreen_enabled = TRUE;
+ success = TRUE;
+ }
+ }
+
+ if ((!setup.fullscreen && fullscreen_enabled) || !window)
+ {
+ /* switch display to window mode */
+ DrawWindow window_old = window;
+ DrawWindow window_new;
+
+ if ((window_new = SDL_SetVideoMode(WIN_XSIZE, WIN_YSIZE, WIN_SDL_DEPTH,
+ SDL_HWSURFACE))
+ == NULL)
+ {
+ /* switching display to window mode failed -- should not happen */
+ Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError());
+
+ success = FALSE;
+ }
+ else
+ {
+ if (window_old)
+ SDL_FreeSurface(window_old);
+ window = window_new;
+
+ fullscreen_enabled = FALSE;
+ success = TRUE;
+ }
+ }
+#else
+ if (setup.fullscreen && fullscreen_available)
+ {
+ Error(ERR_WARN, "fullscreen not available in X11 version");
+
+ /* display error message only once */
+ fullscreen_available = FALSE;
+
+ success = FALSE;
+ }
+#endif
+
+ return success;
+}
+
+inline void ChangeVideoModeIfNeeded(void)
+{
+#ifdef USE_SDL_LIBRARY
+ if ((setup.fullscreen && !fullscreen_enabled && fullscreen_available) ||
+ (!setup.fullscreen && fullscreen_enabled))
+ SetVideoMode();
+ SetDrawtoField(DRAW_BACKBUFFER);
+#endif
+}
+
+inline void dummy(void)