src/video/SDL_video.c
changeset 2753 0969758c8809
parent 2745 587d2b5fb805
child 2785 fa1095d42a5b
     1.1 --- a/src/video/SDL_video.c	Mon Sep 15 04:31:30 2008 +0000
     1.2 +++ b/src/video/SDL_video.c	Mon Sep 15 04:32:36 2008 +0000
     1.3 @@ -35,7 +35,7 @@
     1.4  
     1.5  #if SDL_VIDEO_OPENGL_ES
     1.6  #include "SDL_opengles.h"
     1.7 -#endif				/* SDL_VIDEO_OPENGL_ES */
     1.8 +#endif /* SDL_VIDEO_OPENGL_ES */
     1.9  
    1.10  #if SDL_VIDEO_OPENGL
    1.11  #include "SDL_opengl.h"
    1.12 @@ -44,128 +44,128 @@
    1.13  #ifdef CreateWindow
    1.14  #undef CreateWindow
    1.15  #endif
    1.16 -#endif				/* SDL_VIDEO_OPENGL */
    1.17 +#endif /* SDL_VIDEO_OPENGL */
    1.18  
    1.19  /* Available video drivers */
    1.20  static VideoBootStrap *bootstrap[] = {
    1.21  #if SDL_VIDEO_DRIVER_COCOA
    1.22 -	&COCOA_bootstrap,
    1.23 +    &COCOA_bootstrap,
    1.24  #endif
    1.25  #if SDL_VIDEO_DRIVER_X11
    1.26 -	&X11_bootstrap,
    1.27 +    &X11_bootstrap,
    1.28  #endif
    1.29  #if SDL_VIDEO_DRIVER_NANOX
    1.30 -	&NX_bootstrap,
    1.31 +    &NX_bootstrap,
    1.32  #endif
    1.33  #if SDL_VIDEO_DRIVER_IPOD
    1.34 -	&iPod_bootstrap,
    1.35 +    &iPod_bootstrap,
    1.36  #endif
    1.37  #if SDL_VIDEO_DRIVER_WSCONS
    1.38 -	&WSCONS_bootstrap,
    1.39 +    &WSCONS_bootstrap,
    1.40  #endif
    1.41  #if SDL_VIDEO_DRIVER_FBCON
    1.42 -	&FBCON_bootstrap,
    1.43 +    &FBCON_bootstrap,
    1.44  #endif
    1.45  #if SDL_VIDEO_DRIVER_DIRECTFB
    1.46 -	&DirectFB_bootstrap,
    1.47 +    &DirectFB_bootstrap,
    1.48  #endif
    1.49  #if SDL_VIDEO_DRIVER_PS2GS
    1.50 -	&PS2GS_bootstrap,
    1.51 +    &PS2GS_bootstrap,
    1.52  #endif
    1.53  #if SDL_VIDEO_DRIVER_VGL
    1.54 -	&VGL_bootstrap,
    1.55 +    &VGL_bootstrap,
    1.56  #endif
    1.57  #if SDL_VIDEO_DRIVER_SVGALIB
    1.58 -	&SVGALIB_bootstrap,
    1.59 +    &SVGALIB_bootstrap,
    1.60  #endif
    1.61  #if SDL_VIDEO_DRIVER_GAPI
    1.62 -	&GAPI_bootstrap,
    1.63 +    &GAPI_bootstrap,
    1.64  #endif
    1.65  #if SDL_VIDEO_DRIVER_WIN32
    1.66 -	&WIN32_bootstrap,
    1.67 +    &WIN32_bootstrap,
    1.68  #endif
    1.69  #if SDL_VIDEO_DRIVER_BWINDOW
    1.70 -	&BWINDOW_bootstrap,
    1.71 +    &BWINDOW_bootstrap,
    1.72  #endif
    1.73  #if SDL_VIDEO_DRIVER_PHOTON
    1.74 -	&ph_bootstrap,
    1.75 +    &ph_bootstrap,
    1.76  #endif
    1.77  #if SDL_VIDEO_DRIVER_EPOC
    1.78 -	&EPOC_bootstrap,
    1.79 +    &EPOC_bootstrap,
    1.80  #endif
    1.81  #if SDL_VIDEO_DRIVER_XBIOS
    1.82 -	&XBIOS_bootstrap,
    1.83 +    &XBIOS_bootstrap,
    1.84  #endif
    1.85  #if SDL_VIDEO_DRIVER_GEM
    1.86 -	&GEM_bootstrap,
    1.87 +    &GEM_bootstrap,
    1.88  #endif
    1.89  #if SDL_VIDEO_DRIVER_DC
    1.90 -	&DC_bootstrap,
    1.91 +    &DC_bootstrap,
    1.92  #endif
    1.93  #if SDL_VIDEO_DRIVER_RISCOS
    1.94 -	&RISCOS_bootstrap,
    1.95 +    &RISCOS_bootstrap,
    1.96  #endif
    1.97  #if SDL_VIDEO_DRIVER_OS2FS
    1.98 -	&OS2FSLib_bootstrap,
    1.99 +    &OS2FSLib_bootstrap,
   1.100  #endif
   1.101  #if SDL_VIDEO_DRIVER_NDS
   1.102 -	&NDS_bootstrap,
   1.103 +    &NDS_bootstrap,
   1.104  #endif
   1.105  #if SDL_VIDEO_DRIVER_UIKIT
   1.106 -	&UIKIT_bootstrap,
   1.107 +    &UIKIT_bootstrap,
   1.108  #endif
   1.109  #if SDL_VIDEO_DRIVER_DUMMY
   1.110 -	&DUMMY_bootstrap,
   1.111 +    &DUMMY_bootstrap,
   1.112  #endif
   1.113 -	NULL
   1.114 +    NULL
   1.115  };
   1.116  
   1.117  static SDL_VideoDevice *_this = NULL;
   1.118  
   1.119  /* Various local functions */
   1.120 -int             SDL_VideoInit(const char *driver_name, Uint32 flags);
   1.121 -void            SDL_VideoQuit(void);
   1.122 +int SDL_VideoInit(const char *driver_name, Uint32 flags);
   1.123 +void SDL_VideoQuit(void);
   1.124  
   1.125  static int
   1.126  cmpmodes(const void *A, const void *B)
   1.127  {
   1.128 -	SDL_DisplayMode a = *(const SDL_DisplayMode *) A;
   1.129 -	SDL_DisplayMode b = *(const SDL_DisplayMode *) B;
   1.130 +    SDL_DisplayMode a = *(const SDL_DisplayMode *) A;
   1.131 +    SDL_DisplayMode b = *(const SDL_DisplayMode *) B;
   1.132  
   1.133 -	if (a.w != b.w) {
   1.134 -		return b.w - a.w;
   1.135 -	}
   1.136 -	if (a.h != b.h) {
   1.137 -		return b.h - a.h;
   1.138 -	}
   1.139 -	if (SDL_BITSPERPIXEL(a.format) != SDL_BITSPERPIXEL(b.format)) {
   1.140 -		return SDL_BITSPERPIXEL(b.format) - SDL_BITSPERPIXEL(a.format);
   1.141 -	}
   1.142 -	if (a.refresh_rate != b.refresh_rate) {
   1.143 -		return b.refresh_rate - a.refresh_rate;
   1.144 -	}
   1.145 -	return 0;
   1.146 +    if (a.w != b.w) {
   1.147 +        return b.w - a.w;
   1.148 +    }
   1.149 +    if (a.h != b.h) {
   1.150 +        return b.h - a.h;
   1.151 +    }
   1.152 +    if (SDL_BITSPERPIXEL(a.format) != SDL_BITSPERPIXEL(b.format)) {
   1.153 +        return SDL_BITSPERPIXEL(b.format) - SDL_BITSPERPIXEL(a.format);
   1.154 +    }
   1.155 +    if (a.refresh_rate != b.refresh_rate) {
   1.156 +        return b.refresh_rate - a.refresh_rate;
   1.157 +    }
   1.158 +    return 0;
   1.159  }
   1.160  
   1.161  static void
   1.162  SDL_UninitializedVideo()
   1.163  {
   1.164 -	SDL_SetError("Video subsystem has not been initialized");
   1.165 +    SDL_SetError("Video subsystem has not been initialized");
   1.166  }
   1.167  
   1.168  int
   1.169  SDL_GetNumVideoDrivers(void)
   1.170  {
   1.171 -	return SDL_arraysize(bootstrap) - 1;
   1.172 +    return SDL_arraysize(bootstrap) - 1;
   1.173  }
   1.174  
   1.175 -const char     *
   1.176 +const char *
   1.177  SDL_GetVideoDriver(int index)
   1.178  {
   1.179 -	if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
   1.180 -		return bootstrap[index]->name;
   1.181 -	}
   1.182 -	return NULL;
   1.183 +    if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
   1.184 +        return bootstrap[index]->name;
   1.185 +    }
   1.186 +    return NULL;
   1.187  }
   1.188  
   1.189  /*
   1.190 @@ -174,1045 +174,1045 @@
   1.191  int
   1.192  SDL_VideoInit(const char *driver_name, Uint32 flags)
   1.193  {
   1.194 -	SDL_VideoDevice *video;
   1.195 -	int             index;
   1.196 -	int             i;
   1.197 +    SDL_VideoDevice *video;
   1.198 +    int index;
   1.199 +    int i;
   1.200  
   1.201 -	/* Toggle the event thread flags, based on OS requirements */
   1.202 +    /* Toggle the event thread flags, based on OS requirements */
   1.203  #if defined(MUST_THREAD_EVENTS)
   1.204 -	flags |= SDL_INIT_EVENTTHREAD;
   1.205 +    flags |= SDL_INIT_EVENTTHREAD;
   1.206  #elif defined(CANT_THREAD_EVENTS)
   1.207 -	if ((flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD) {
   1.208 -		SDL_SetError("OS doesn't support threaded events");
   1.209 -		return -1;
   1.210 -	}
   1.211 +    if ((flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD) {
   1.212 +        SDL_SetError("OS doesn't support threaded events");
   1.213 +        return -1;
   1.214 +    }
   1.215  #endif
   1.216  
   1.217 -	/* Start the event loop */
   1.218 -	if (SDL_StartEventLoop(flags) < 0) {
   1.219 -		return -1;
   1.220 -	}
   1.221 -	/* Check to make sure we don't overwrite '_this' */
   1.222 -	if (_this != NULL) {
   1.223 -		SDL_VideoQuit();
   1.224 -	}
   1.225 -	/* Select the proper video driver */
   1.226 -	index = 0;
   1.227 -	video = NULL;
   1.228 -	if (driver_name == NULL) {
   1.229 -		driver_name = SDL_getenv("SDL_VIDEODRIVER");
   1.230 -	}
   1.231 -	if (driver_name != NULL) {
   1.232 -		for (i = 0; bootstrap[i]; ++i) {
   1.233 -			if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {
   1.234 -				if (bootstrap[i]->available()) {
   1.235 -					video = bootstrap[i]->create(index);
   1.236 -				}
   1.237 -				break;
   1.238 -			}
   1.239 -		}
   1.240 -	} else {
   1.241 -		for (i = 0; bootstrap[i]; ++i) {
   1.242 -			if (bootstrap[i]->available()) {
   1.243 -				video = bootstrap[i]->create(index);
   1.244 -				if (video != NULL) {
   1.245 -					break;
   1.246 -				}
   1.247 -			}
   1.248 -		}
   1.249 -	}
   1.250 -	if (video == NULL) {
   1.251 -		if (driver_name) {
   1.252 -			SDL_SetError("%s not available", driver_name);
   1.253 -		} else {
   1.254 -			SDL_SetError("No available video device");
   1.255 -		}
   1.256 -		return -1;
   1.257 -	}
   1.258 -	_this = video;
   1.259 -	_this->name = bootstrap[i]->name;
   1.260 -	_this->next_object_id = 1;
   1.261 +    /* Start the event loop */
   1.262 +    if (SDL_StartEventLoop(flags) < 0) {
   1.263 +        return -1;
   1.264 +    }
   1.265 +    /* Check to make sure we don't overwrite '_this' */
   1.266 +    if (_this != NULL) {
   1.267 +        SDL_VideoQuit();
   1.268 +    }
   1.269 +    /* Select the proper video driver */
   1.270 +    index = 0;
   1.271 +    video = NULL;
   1.272 +    if (driver_name == NULL) {
   1.273 +        driver_name = SDL_getenv("SDL_VIDEODRIVER");
   1.274 +    }
   1.275 +    if (driver_name != NULL) {
   1.276 +        for (i = 0; bootstrap[i]; ++i) {
   1.277 +            if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {
   1.278 +                if (bootstrap[i]->available()) {
   1.279 +                    video = bootstrap[i]->create(index);
   1.280 +                }
   1.281 +                break;
   1.282 +            }
   1.283 +        }
   1.284 +    } else {
   1.285 +        for (i = 0; bootstrap[i]; ++i) {
   1.286 +            if (bootstrap[i]->available()) {
   1.287 +                video = bootstrap[i]->create(index);
   1.288 +                if (video != NULL) {
   1.289 +                    break;
   1.290 +                }
   1.291 +            }
   1.292 +        }
   1.293 +    }
   1.294 +    if (video == NULL) {
   1.295 +        if (driver_name) {
   1.296 +            SDL_SetError("%s not available", driver_name);
   1.297 +        } else {
   1.298 +            SDL_SetError("No available video device");
   1.299 +        }
   1.300 +        return -1;
   1.301 +    }
   1.302 +    _this = video;
   1.303 +    _this->name = bootstrap[i]->name;
   1.304 +    _this->next_object_id = 1;
   1.305  
   1.306  
   1.307 -	/* Set some very sane GL defaults */
   1.308 -	_this->gl_config.driver_loaded = 0;
   1.309 -	_this->gl_config.dll_handle = NULL;
   1.310 -	_this->gl_config.red_size = 3;
   1.311 -	_this->gl_config.green_size = 3;
   1.312 -	_this->gl_config.blue_size = 2;
   1.313 -	_this->gl_config.alpha_size = 0;
   1.314 -	_this->gl_config.buffer_size = 0;
   1.315 -	_this->gl_config.depth_size = 16;
   1.316 -	_this->gl_config.stencil_size = 0;
   1.317 -	_this->gl_config.double_buffer = 1;
   1.318 -	_this->gl_config.accum_red_size = 0;
   1.319 -	_this->gl_config.accum_green_size = 0;
   1.320 -	_this->gl_config.accum_blue_size = 0;
   1.321 -	_this->gl_config.accum_alpha_size = 0;
   1.322 -	_this->gl_config.stereo = 0;
   1.323 -	_this->gl_config.multisamplebuffers = 0;
   1.324 -	_this->gl_config.multisamplesamples = 0;
   1.325 -	_this->gl_config.retained_backing = 1;
   1.326 -	_this->gl_config.accelerated = -1;	/* not known, don't set */
   1.327 +    /* Set some very sane GL defaults */
   1.328 +    _this->gl_config.driver_loaded = 0;
   1.329 +    _this->gl_config.dll_handle = NULL;
   1.330 +    _this->gl_config.red_size = 3;
   1.331 +    _this->gl_config.green_size = 3;
   1.332 +    _this->gl_config.blue_size = 2;
   1.333 +    _this->gl_config.alpha_size = 0;
   1.334 +    _this->gl_config.buffer_size = 0;
   1.335 +    _this->gl_config.depth_size = 16;
   1.336 +    _this->gl_config.stencil_size = 0;
   1.337 +    _this->gl_config.double_buffer = 1;
   1.338 +    _this->gl_config.accum_red_size = 0;
   1.339 +    _this->gl_config.accum_green_size = 0;
   1.340 +    _this->gl_config.accum_blue_size = 0;
   1.341 +    _this->gl_config.accum_alpha_size = 0;
   1.342 +    _this->gl_config.stereo = 0;
   1.343 +    _this->gl_config.multisamplebuffers = 0;
   1.344 +    _this->gl_config.multisamplesamples = 0;
   1.345 +    _this->gl_config.retained_backing = 1;
   1.346 +    _this->gl_config.accelerated = -1;  /* not known, don't set */
   1.347  
   1.348 -	/* Initialize the video subsystem */
   1.349 -	if (_this->VideoInit(_this) < 0) {
   1.350 -		SDL_VideoQuit();
   1.351 -		return -1;
   1.352 -	}
   1.353 -	/* Make sure some displays were added */
   1.354 -	if (_this->num_displays == 0) {
   1.355 -		SDL_SetError("The video driver did not add any displays");
   1.356 -		SDL_VideoQuit();
   1.357 -		return (-1);
   1.358 -	}
   1.359 -	/* The software renderer is always available */
   1.360 -	for (i = 0; i < _this->num_displays; ++i) {
   1.361 +    /* Initialize the video subsystem */
   1.362 +    if (_this->VideoInit(_this) < 0) {
   1.363 +        SDL_VideoQuit();
   1.364 +        return -1;
   1.365 +    }
   1.366 +    /* Make sure some displays were added */
   1.367 +    if (_this->num_displays == 0) {
   1.368 +        SDL_SetError("The video driver did not add any displays");
   1.369 +        SDL_VideoQuit();
   1.370 +        return (-1);
   1.371 +    }
   1.372 +    /* The software renderer is always available */
   1.373 +    for (i = 0; i < _this->num_displays; ++i) {
   1.374  #if SDL_VIDEO_RENDER_OGL
   1.375 -		SDL_AddRenderDriver(i, &GL_RenderDriver);
   1.376 +        SDL_AddRenderDriver(i, &GL_RenderDriver);
   1.377  #endif
   1.378  
   1.379  #if SDL_VIDEO_RENDER_OGL_ES
   1.380 -		SDL_AddRenderDriver(i, &GL_ES_RenderDriver);
   1.381 +        SDL_AddRenderDriver(i, &GL_ES_RenderDriver);
   1.382  #endif
   1.383 -		if (_this->displays[i].num_render_drivers > 0) {
   1.384 -			SDL_AddRenderDriver(i, &SW_RenderDriver);
   1.385 -		}
   1.386 -	}
   1.387 +        if (_this->displays[i].num_render_drivers > 0) {
   1.388 +            SDL_AddRenderDriver(i, &SW_RenderDriver);
   1.389 +        }
   1.390 +    }
   1.391  
   1.392 -	/* We're ready to go! */
   1.393 -	return 0;
   1.394 +    /* We're ready to go! */
   1.395 +    return 0;
   1.396  }
   1.397  
   1.398 -const char     *
   1.399 +const char *
   1.400  SDL_GetCurrentVideoDriver()
   1.401  {
   1.402 -	if (!_this) {
   1.403 -		SDL_UninitializedVideo();
   1.404 -		return NULL;
   1.405 -	}
   1.406 -	return _this->name;
   1.407 +    if (!_this) {
   1.408 +        SDL_UninitializedVideo();
   1.409 +        return NULL;
   1.410 +    }
   1.411 +    return _this->name;
   1.412  }
   1.413  
   1.414  SDL_VideoDevice *
   1.415  SDL_GetVideoDevice()
   1.416  {
   1.417 -	return _this;
   1.418 +    return _this;
   1.419  }
   1.420  
   1.421  int
   1.422  SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode)
   1.423  {
   1.424 -	SDL_VideoDisplay display;
   1.425 +    SDL_VideoDisplay display;
   1.426  
   1.427 -	SDL_zero(display);
   1.428 -	if (desktop_mode) {
   1.429 -		display.desktop_mode = *desktop_mode;
   1.430 -	}
   1.431 -	display.current_mode = display.desktop_mode;
   1.432 +    SDL_zero(display);
   1.433 +    if (desktop_mode) {
   1.434 +        display.desktop_mode = *desktop_mode;
   1.435 +    }
   1.436 +    display.current_mode = display.desktop_mode;
   1.437  
   1.438 -	return SDL_AddVideoDisplay(&display);
   1.439 +    return SDL_AddVideoDisplay(&display);
   1.440  }
   1.441  
   1.442  int
   1.443  SDL_AddVideoDisplay(const SDL_VideoDisplay * display)
   1.444  {
   1.445 -	SDL_VideoDisplay *displays;
   1.446 -	int             index = -1;
   1.447 +    SDL_VideoDisplay *displays;
   1.448 +    int index = -1;
   1.449  
   1.450 -	displays =
   1.451 -		SDL_realloc(_this->displays,
   1.452 -			    (_this->num_displays + 1) * sizeof(*displays));
   1.453 -	if (displays) {
   1.454 -		index = _this->num_displays++;
   1.455 -		displays[index] = *display;
   1.456 -		displays[index].device = _this;
   1.457 -		_this->displays = displays;
   1.458 -	} else {
   1.459 -		SDL_OutOfMemory();
   1.460 -	}
   1.461 -	return index;
   1.462 +    displays =
   1.463 +        SDL_realloc(_this->displays,
   1.464 +                    (_this->num_displays + 1) * sizeof(*displays));
   1.465 +    if (displays) {
   1.466 +        index = _this->num_displays++;
   1.467 +        displays[index] = *display;
   1.468 +        displays[index].device = _this;
   1.469 +        _this->displays = displays;
   1.470 +    } else {
   1.471 +        SDL_OutOfMemory();
   1.472 +    }
   1.473 +    return index;
   1.474  }
   1.475  
   1.476  int
   1.477  SDL_GetNumVideoDisplays(void)
   1.478  {
   1.479 -	if (!_this) {
   1.480 -		SDL_UninitializedVideo();
   1.481 -		return 0;
   1.482 -	}
   1.483 -	return _this->num_displays;
   1.484 +    if (!_this) {
   1.485 +        SDL_UninitializedVideo();
   1.486 +        return 0;
   1.487 +    }
   1.488 +    return _this->num_displays;
   1.489  }
   1.490  
   1.491  int
   1.492  SDL_SelectVideoDisplay(int index)
   1.493  {
   1.494 -	if (!_this) {
   1.495 -		SDL_UninitializedVideo();
   1.496 -		return (-1);
   1.497 -	}
   1.498 -	if (index < 0 || index >= _this->num_displays) {
   1.499 -		SDL_SetError("index must be in the range 0 - %d",
   1.500 -			     _this->num_displays - 1);
   1.501 -		return -1;
   1.502 -	}
   1.503 -	_this->current_display = index;
   1.504 -	return 0;
   1.505 +    if (!_this) {
   1.506 +        SDL_UninitializedVideo();
   1.507 +        return (-1);
   1.508 +    }
   1.509 +    if (index < 0 || index >= _this->num_displays) {
   1.510 +        SDL_SetError("index must be in the range 0 - %d",
   1.511 +                     _this->num_displays - 1);
   1.512 +        return -1;
   1.513 +    }
   1.514 +    _this->current_display = index;
   1.515 +    return 0;
   1.516  }
   1.517  
   1.518  int
   1.519  SDL_GetCurrentVideoDisplay(void)
   1.520  {
   1.521 -	if (!_this) {
   1.522 -		SDL_UninitializedVideo();
   1.523 -		return (-1);
   1.524 -	}
   1.525 -	return _this->current_display;
   1.526 +    if (!_this) {
   1.527 +        SDL_UninitializedVideo();
   1.528 +        return (-1);
   1.529 +    }
   1.530 +    return _this->current_display;
   1.531  }
   1.532  
   1.533  SDL_bool
   1.534  SDL_AddDisplayMode(int displayIndex, const SDL_DisplayMode * mode)
   1.535  {
   1.536 -	SDL_VideoDisplay *display = &_this->displays[displayIndex];
   1.537 -	SDL_DisplayMode *modes;
   1.538 -	int             i, nmodes;
   1.539 +    SDL_VideoDisplay *display = &_this->displays[displayIndex];
   1.540 +    SDL_DisplayMode *modes;
   1.541 +    int i, nmodes;
   1.542  
   1.543 -	/* Make sure we don't already have the mode in the list */
   1.544 -	modes = display->display_modes;
   1.545 -	nmodes = display->num_display_modes;
   1.546 -	for (i = nmodes; i--;) {
   1.547 -		if (SDL_memcmp(mode, &modes[i], sizeof(*mode)) == 0) {
   1.548 -			return SDL_FALSE;
   1.549 -		}
   1.550 -	}
   1.551 +    /* Make sure we don't already have the mode in the list */
   1.552 +    modes = display->display_modes;
   1.553 +    nmodes = display->num_display_modes;
   1.554 +    for (i = nmodes; i--;) {
   1.555 +        if (SDL_memcmp(mode, &modes[i], sizeof(*mode)) == 0) {
   1.556 +            return SDL_FALSE;
   1.557 +        }
   1.558 +    }
   1.559  
   1.560 -	/* Go ahead and add the new mode */
   1.561 -	if (nmodes == display->max_display_modes) {
   1.562 -		modes =
   1.563 -			SDL_realloc(modes,
   1.564 -			(display->max_display_modes + 32) * sizeof(*modes));
   1.565 -		if (!modes) {
   1.566 -			return SDL_FALSE;
   1.567 -		}
   1.568 -		display->display_modes = modes;
   1.569 -		display->max_display_modes += 32;
   1.570 -	}
   1.571 -	modes[nmodes] = *mode;
   1.572 -	display->num_display_modes++;
   1.573 +    /* Go ahead and add the new mode */
   1.574 +    if (nmodes == display->max_display_modes) {
   1.575 +        modes =
   1.576 +            SDL_realloc(modes,
   1.577 +                        (display->max_display_modes + 32) * sizeof(*modes));
   1.578 +        if (!modes) {
   1.579 +            return SDL_FALSE;
   1.580 +        }
   1.581 +        display->display_modes = modes;
   1.582 +        display->max_display_modes += 32;
   1.583 +    }
   1.584 +    modes[nmodes] = *mode;
   1.585 +    display->num_display_modes++;
   1.586  
   1.587 -	return SDL_TRUE;
   1.588 +    return SDL_TRUE;
   1.589  }
   1.590  
   1.591  int
   1.592  SDL_GetNumDisplayModes()
   1.593  {
   1.594 -	if (_this) {
   1.595 -		SDL_VideoDisplay *display = &SDL_CurrentDisplay;
   1.596 -		if (!display->num_display_modes && _this->GetDisplayModes) {
   1.597 -			_this->GetDisplayModes(_this);
   1.598 -			SDL_qsort(display->display_modes, display->num_display_modes,
   1.599 -				  sizeof(SDL_DisplayMode), cmpmodes);
   1.600 -		}
   1.601 -		return display->num_display_modes;
   1.602 -	}
   1.603 -	return 0;
   1.604 +    if (_this) {
   1.605 +        SDL_VideoDisplay *display = &SDL_CurrentDisplay;
   1.606 +        if (!display->num_display_modes && _this->GetDisplayModes) {
   1.607 +            _this->GetDisplayModes(_this);
   1.608 +            SDL_qsort(display->display_modes, display->num_display_modes,
   1.609 +                      sizeof(SDL_DisplayMode), cmpmodes);
   1.610 +        }
   1.611 +        return display->num_display_modes;
   1.612 +    }
   1.613 +    return 0;
   1.614  }
   1.615  
   1.616  int
   1.617  SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
   1.618  {
   1.619 -	if (index < 0 || index >= SDL_GetNumDisplayModes()) {
   1.620 -		SDL_SetError("index must be in the range of 0 - %d",
   1.621 -			     SDL_GetNumDisplayModes() - 1);
   1.622 -		return -1;
   1.623 -	}
   1.624 -	if (mode) {
   1.625 -		*mode = SDL_CurrentDisplay.display_modes[index];
   1.626 -	}
   1.627 -	return 0;
   1.628 +    if (index < 0 || index >= SDL_GetNumDisplayModes()) {
   1.629 +        SDL_SetError("index must be in the range of 0 - %d",
   1.630 +                     SDL_GetNumDisplayModes() - 1);
   1.631 +        return -1;
   1.632 +    }
   1.633 +    if (mode) {
   1.634 +        *mode = SDL_CurrentDisplay.display_modes[index];
   1.635 +    }
   1.636 +    return 0;
   1.637  }
   1.638  
   1.639  int
   1.640  SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode)
   1.641  {
   1.642 -	if (!_this) {
   1.643 -		SDL_UninitializedVideo();
   1.644 -		return -1;
   1.645 -	}
   1.646 -	if (mode) {
   1.647 -		*mode = SDL_CurrentDisplay.desktop_mode;
   1.648 -	}
   1.649 -	return 0;
   1.650 +    if (!_this) {
   1.651 +        SDL_UninitializedVideo();
   1.652 +        return -1;
   1.653 +    }
   1.654 +    if (mode) {
   1.655 +        *mode = SDL_CurrentDisplay.desktop_mode;
   1.656 +    }
   1.657 +    return 0;
   1.658  }
   1.659  
   1.660  int
   1.661  SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode)
   1.662  {
   1.663 -	if (!_this) {
   1.664 -		SDL_UninitializedVideo();
   1.665 -		return -1;
   1.666 -	}
   1.667 -	if (mode) {
   1.668 -		*mode = SDL_CurrentDisplay.current_mode;
   1.669 -	}
   1.670 -	return 0;
   1.671 +    if (!_this) {
   1.672 +        SDL_UninitializedVideo();
   1.673 +        return -1;
   1.674 +    }
   1.675 +    if (mode) {
   1.676 +        *mode = SDL_CurrentDisplay.current_mode;
   1.677 +    }
   1.678 +    return 0;
   1.679  }
   1.680  
   1.681  SDL_DisplayMode *
   1.682  SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
   1.683 -			  SDL_DisplayMode * closest)
   1.684 +                          SDL_DisplayMode * closest)
   1.685  {
   1.686 -	Uint32          target_format;
   1.687 -	int             target_refresh_rate;
   1.688 -	int             i;
   1.689 -	SDL_DisplayMode *current, *match;
   1.690 +    Uint32 target_format;
   1.691 +    int target_refresh_rate;
   1.692 +    int i;
   1.693 +    SDL_DisplayMode *current, *match;
   1.694  
   1.695 -	if (!_this || !mode || !closest) {
   1.696 -		return NULL;
   1.697 -	}
   1.698 -	/* Default to the desktop format */
   1.699 -	if (mode->format) {
   1.700 -		target_format = mode->format;
   1.701 -	} else {
   1.702 -		target_format = SDL_CurrentDisplay.desktop_mode.format;
   1.703 -	}
   1.704 +    if (!_this || !mode || !closest) {
   1.705 +        return NULL;
   1.706 +    }
   1.707 +    /* Default to the desktop format */
   1.708 +    if (mode->format) {
   1.709 +        target_format = mode->format;
   1.710 +    } else {
   1.711 +        target_format = SDL_CurrentDisplay.desktop_mode.format;
   1.712 +    }
   1.713  
   1.714 -	/* Default to the desktop refresh rate */
   1.715 -	if (mode->refresh_rate) {
   1.716 -		target_refresh_rate = mode->refresh_rate;
   1.717 -	} else {
   1.718 -		target_refresh_rate = SDL_CurrentDisplay.desktop_mode.refresh_rate;
   1.719 -	}
   1.720 +    /* Default to the desktop refresh rate */
   1.721 +    if (mode->refresh_rate) {
   1.722 +        target_refresh_rate = mode->refresh_rate;
   1.723 +    } else {
   1.724 +        target_refresh_rate = SDL_CurrentDisplay.desktop_mode.refresh_rate;
   1.725 +    }
   1.726  
   1.727 -	match = NULL;
   1.728 -	for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
   1.729 -		current = &SDL_CurrentDisplay.display_modes[i];
   1.730 +    match = NULL;
   1.731 +    for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
   1.732 +        current = &SDL_CurrentDisplay.display_modes[i];
   1.733  
   1.734 -		if ((current->w && current->h) &&
   1.735 -		    (current->w < mode->w || current->h < mode->h)) {
   1.736 -			/* Out of sorted modes large enough here */
   1.737 -			break;
   1.738 -		}
   1.739 -		if (!match || current->w < match->w || current->h < match->h) {
   1.740 -			match = current;
   1.741 -			continue;
   1.742 -		}
   1.743 -		if (current->format != match->format) {
   1.744 -			/* Sorted highest depth to lowest */
   1.745 -			if (current->format == target_format ||
   1.746 -			    (SDL_BITSPERPIXEL(current->format) >=
   1.747 -			     SDL_BITSPERPIXEL(target_format)
   1.748 -			     && SDL_PIXELTYPE(current->format) ==
   1.749 -			     SDL_PIXELTYPE(target_format))) {
   1.750 -				match = current;
   1.751 -			}
   1.752 -			continue;
   1.753 -		}
   1.754 -		if (current->refresh_rate != match->refresh_rate) {
   1.755 -			/* Sorted highest refresh to lowest */
   1.756 -			if (current->refresh_rate >= target_refresh_rate) {
   1.757 -				match = current;
   1.758 -			}
   1.759 -		}
   1.760 -	}
   1.761 -	if (match) {
   1.762 -		if (match->format) {
   1.763 -			closest->format = match->format;
   1.764 -		} else {
   1.765 -			closest->format = mode->format;
   1.766 -		}
   1.767 -		if (match->w && match->h) {
   1.768 -			closest->w = match->w;
   1.769 -			closest->h = match->h;
   1.770 -		} else {
   1.771 -			closest->w = mode->w;
   1.772 -			closest->h = mode->h;
   1.773 -		}
   1.774 -		if (match->refresh_rate) {
   1.775 -			closest->refresh_rate = match->refresh_rate;
   1.776 -		} else {
   1.777 -			closest->refresh_rate = mode->refresh_rate;
   1.778 -		}
   1.779 -		closest->driverdata = match->driverdata;
   1.780 +        if ((current->w && current->h) &&
   1.781 +            (current->w < mode->w || current->h < mode->h)) {
   1.782 +            /* Out of sorted modes large enough here */
   1.783 +            break;
   1.784 +        }
   1.785 +        if (!match || current->w < match->w || current->h < match->h) {
   1.786 +            match = current;
   1.787 +            continue;
   1.788 +        }
   1.789 +        if (current->format != match->format) {
   1.790 +            /* Sorted highest depth to lowest */
   1.791 +            if (current->format == target_format ||
   1.792 +                (SDL_BITSPERPIXEL(current->format) >=
   1.793 +                 SDL_BITSPERPIXEL(target_format)
   1.794 +                 && SDL_PIXELTYPE(current->format) ==
   1.795 +                 SDL_PIXELTYPE(target_format))) {
   1.796 +                match = current;
   1.797 +            }
   1.798 +            continue;
   1.799 +        }
   1.800 +        if (current->refresh_rate != match->refresh_rate) {
   1.801 +            /* Sorted highest refresh to lowest */
   1.802 +            if (current->refresh_rate >= target_refresh_rate) {
   1.803 +                match = current;
   1.804 +            }
   1.805 +        }
   1.806 +    }
   1.807 +    if (match) {
   1.808 +        if (match->format) {
   1.809 +            closest->format = match->format;
   1.810 +        } else {
   1.811 +            closest->format = mode->format;
   1.812 +        }
   1.813 +        if (match->w && match->h) {
   1.814 +            closest->w = match->w;
   1.815 +            closest->h = match->h;
   1.816 +        } else {
   1.817 +            closest->w = mode->w;
   1.818 +            closest->h = mode->h;
   1.819 +        }
   1.820 +        if (match->refresh_rate) {
   1.821 +            closest->refresh_rate = match->refresh_rate;
   1.822 +        } else {
   1.823 +            closest->refresh_rate = mode->refresh_rate;
   1.824 +        }
   1.825 +        closest->driverdata = match->driverdata;
   1.826  
   1.827 -		/*
   1.828 -		 * Pick some reasonable defaults if the app and driver don't
   1.829 -		 * care
   1.830 -		 */
   1.831 -		if (!closest->format) {
   1.832 -			closest->format = SDL_PIXELFORMAT_RGB888;
   1.833 -		}
   1.834 -		if (!closest->w) {
   1.835 -			closest->w = 640;
   1.836 -		}
   1.837 -		if (!closest->h) {
   1.838 -			closest->h = 480;
   1.839 -		}
   1.840 -		return closest;
   1.841 -	}
   1.842 -	return NULL;
   1.843 +        /*
   1.844 +         * Pick some reasonable defaults if the app and driver don't
   1.845 +         * care
   1.846 +         */
   1.847 +        if (!closest->format) {
   1.848 +            closest->format = SDL_PIXELFORMAT_RGB888;
   1.849 +        }
   1.850 +        if (!closest->w) {
   1.851 +            closest->w = 640;
   1.852 +        }
   1.853 +        if (!closest->h) {
   1.854 +            closest->h = 480;
   1.855 +        }
   1.856 +        return closest;
   1.857 +    }
   1.858 +    return NULL;
   1.859  }
   1.860  
   1.861  int
   1.862  SDL_SetDisplayMode(const SDL_DisplayMode * mode)
   1.863  {
   1.864 -	SDL_VideoDisplay *display;
   1.865 -	SDL_DisplayMode display_mode;
   1.866 -	SDL_DisplayMode current_mode;
   1.867 -	int             i, ncolors;
   1.868 +    SDL_VideoDisplay *display;
   1.869 +    SDL_DisplayMode display_mode;
   1.870 +    SDL_DisplayMode current_mode;
   1.871 +    int i, ncolors;
   1.872  
   1.873 -	if (!_this) {
   1.874 -		SDL_UninitializedVideo();
   1.875 -		return -1;
   1.876 -	}
   1.877 -	display = &SDL_CurrentDisplay;
   1.878 -	if (!mode) {
   1.879 -		mode = &display->desktop_mode;
   1.880 -	}
   1.881 -	display_mode = *mode;
   1.882 +    if (!_this) {
   1.883 +        SDL_UninitializedVideo();
   1.884 +        return -1;
   1.885 +    }
   1.886 +    display = &SDL_CurrentDisplay;
   1.887 +    if (!mode) {
   1.888 +        mode = &display->desktop_mode;
   1.889 +    }
   1.890 +    display_mode = *mode;
   1.891  
   1.892 -	/* Default to the current mode */
   1.893 -	if (!display_mode.format) {
   1.894 -		display_mode.format = display->current_mode.format;
   1.895 -	}
   1.896 -	if (!display_mode.w) {
   1.897 -		display_mode.w = display->current_mode.w;
   1.898 -	}
   1.899 -	if (!display_mode.h) {
   1.900 -		display_mode.h = display->current_mode.h;
   1.901 -	}
   1.902 -	if (!display_mode.refresh_rate) {
   1.903 -		display_mode.refresh_rate = display->current_mode.refresh_rate;
   1.904 -	}
   1.905 -	/* Get a good video mode, the closest one possible */
   1.906 -	if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) {
   1.907 -		SDL_SetError("No video mode large enough for %dx%d",
   1.908 -			     display_mode.w, display_mode.h);
   1.909 -		return -1;
   1.910 -	}
   1.911 -	/* See if there's anything left to do */
   1.912 -	SDL_GetCurrentDisplayMode(&current_mode);
   1.913 -	if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
   1.914 -		return 0;
   1.915 -	}
   1.916 -	/* Actually change the display mode */
   1.917 -	if (_this->SetDisplayMode(_this, &display_mode) < 0) {
   1.918 -		return -1;
   1.919 -	}
   1.920 -	display->current_mode = display_mode;
   1.921 +    /* Default to the current mode */
   1.922 +    if (!display_mode.format) {
   1.923 +        display_mode.format = display->current_mode.format;
   1.924 +    }
   1.925 +    if (!display_mode.w) {
   1.926 +        display_mode.w = display->current_mode.w;
   1.927 +    }
   1.928 +    if (!display_mode.h) {
   1.929 +        display_mode.h = display->current_mode.h;
   1.930 +    }
   1.931 +    if (!display_mode.refresh_rate) {
   1.932 +        display_mode.refresh_rate = display->current_mode.refresh_rate;
   1.933 +    }
   1.934 +    /* Get a good video mode, the closest one possible */
   1.935 +    if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) {
   1.936 +        SDL_SetError("No video mode large enough for %dx%d",
   1.937 +                     display_mode.w, display_mode.h);
   1.938 +        return -1;
   1.939 +    }
   1.940 +    /* See if there's anything left to do */
   1.941 +    SDL_GetCurrentDisplayMode(&current_mode);
   1.942 +    if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
   1.943 +        return 0;
   1.944 +    }
   1.945 +    /* Actually change the display mode */
   1.946 +    if (_this->SetDisplayMode(_this, &display_mode) < 0) {
   1.947 +        return -1;
   1.948 +    }
   1.949 +    display->current_mode = display_mode;
   1.950  
   1.951 -	/* Set up a palette, if necessary */
   1.952 -	if (SDL_ISPIXELFORMAT_INDEXED(display_mode.format)) {
   1.953 -		ncolors = (1 << SDL_BITSPERPIXEL(display_mode.format));
   1.954 -	} else {
   1.955 -		ncolors = 0;
   1.956 -	}
   1.957 -	if ((!ncolors && display->palette) || (ncolors && !display->palette)
   1.958 -	    || (ncolors && ncolors != display->palette->ncolors)) {
   1.959 -		if (display->palette) {
   1.960 -			SDL_FreePalette(display->palette);
   1.961 -			display->palette = NULL;
   1.962 -		}
   1.963 -		if (ncolors) {
   1.964 -			display->palette = SDL_AllocPalette(ncolors);
   1.965 -			if (!display->palette) {
   1.966 -				return -1;
   1.967 -			}
   1.968 -			SDL_DitherColors(display->palette->colors,
   1.969 -				     SDL_BITSPERPIXEL(display_mode.format));
   1.970 -		}
   1.971 -	}
   1.972 -	/* Move any fullscreen windows into position */
   1.973 -	for (i = 0; i < display->num_windows; ++i) {
   1.974 -		SDL_Window     *window = &display->windows[i];
   1.975 -		if (FULLSCREEN_VISIBLE(window)) {
   1.976 -			SDL_SetWindowPosition(window->id, SDL_WINDOWPOS_CENTERED,
   1.977 -					      SDL_WINDOWPOS_CENTERED);
   1.978 -		}
   1.979 -	}
   1.980 +    /* Set up a palette, if necessary */
   1.981 +    if (SDL_ISPIXELFORMAT_INDEXED(display_mode.format)) {
   1.982 +        ncolors = (1 << SDL_BITSPERPIXEL(display_mode.format));
   1.983 +    } else {
   1.984 +        ncolors = 0;
   1.985 +    }
   1.986 +    if ((!ncolors && display->palette) || (ncolors && !display->palette)
   1.987 +        || (ncolors && ncolors != display->palette->ncolors)) {
   1.988 +        if (display->palette) {
   1.989 +            SDL_FreePalette(display->palette);
   1.990 +            display->palette = NULL;
   1.991 +        }
   1.992 +        if (ncolors) {
   1.993 +            display->palette = SDL_AllocPalette(ncolors);
   1.994 +            if (!display->palette) {
   1.995 +                return -1;
   1.996 +            }
   1.997 +            SDL_DitherColors(display->palette->colors,
   1.998 +                             SDL_BITSPERPIXEL(display_mode.format));
   1.999 +        }
  1.1000 +    }
  1.1001 +    /* Move any fullscreen windows into position */
  1.1002 +    for (i = 0; i < display->num_windows; ++i) {
  1.1003 +        SDL_Window *window = &display->windows[i];
  1.1004 +        if (FULLSCREEN_VISIBLE(window)) {
  1.1005 +            SDL_SetWindowPosition(window->id, SDL_WINDOWPOS_CENTERED,
  1.1006 +                                  SDL_WINDOWPOS_CENTERED);
  1.1007 +        }
  1.1008 +    }
  1.1009  
  1.1010 -	return 0;
  1.1011 +    return 0;
  1.1012  }
  1.1013  
  1.1014  int
  1.1015  SDL_SetFullscreenDisplayMode(const SDL_DisplayMode * mode)
  1.1016  {
  1.1017 -	SDL_VideoDisplay *display;
  1.1018 -	SDL_DisplayMode fullscreen_mode;
  1.1019 -	int             i;
  1.1020 +    SDL_VideoDisplay *display;
  1.1021 +    SDL_DisplayMode fullscreen_mode;
  1.1022 +    int i;
  1.1023  
  1.1024 -	if (!_this) {
  1.1025 -		SDL_UninitializedVideo();
  1.1026 -		return -1;
  1.1027 -	}
  1.1028 -	display = &SDL_CurrentDisplay;
  1.1029 -	if (!mode) {
  1.1030 -		mode = &display->desktop_mode;
  1.1031 -	}
  1.1032 -	SDL_GetClosestDisplayMode(mode, &fullscreen_mode);
  1.1033 -	if (SDL_memcmp
  1.1034 -	    (&fullscreen_mode, &display->fullscreen_mode,
  1.1035 -	     sizeof(fullscreen_mode)) == 0) {
  1.1036 -		/* Nothing to do... */
  1.1037 -		return 0;
  1.1038 -	}
  1.1039 -	display->fullscreen_mode = fullscreen_mode;
  1.1040 +    if (!_this) {
  1.1041 +        SDL_UninitializedVideo();
  1.1042 +        return -1;
  1.1043 +    }
  1.1044 +    display = &SDL_CurrentDisplay;
  1.1045 +    if (!mode) {
  1.1046 +        mode = &display->desktop_mode;
  1.1047 +    }
  1.1048 +    SDL_GetClosestDisplayMode(mode, &fullscreen_mode);
  1.1049 +    if (SDL_memcmp
  1.1050 +        (&fullscreen_mode, &display->fullscreen_mode,
  1.1051 +         sizeof(fullscreen_mode)) == 0) {
  1.1052 +        /* Nothing to do... */
  1.1053 +        return 0;
  1.1054 +    }
  1.1055 +    display->fullscreen_mode = fullscreen_mode;
  1.1056  
  1.1057 -	/* Actually set the mode if we have a fullscreen window visible */
  1.1058 -	for (i = 0; i < display->num_windows; ++i) {
  1.1059 -		SDL_Window     *window = &display->windows[i];
  1.1060 -		if (FULLSCREEN_VISIBLE(window)) {
  1.1061 -			if (SDL_SetDisplayMode(&display->fullscreen_mode) < 0) {
  1.1062 -				return -1;
  1.1063 -			}
  1.1064 -		}
  1.1065 -		if (window->flags & SDL_WINDOW_FULLSCREEN) {
  1.1066 -			SDL_OnWindowResized(window);
  1.1067 -		}
  1.1068 -	}
  1.1069 -	return 0;
  1.1070 +    /* Actually set the mode if we have a fullscreen window visible */
  1.1071 +    for (i = 0; i < display->num_windows; ++i) {
  1.1072 +        SDL_Window *window = &display->windows[i];
  1.1073 +        if (FULLSCREEN_VISIBLE(window)) {
  1.1074 +            if (SDL_SetDisplayMode(&display->fullscreen_mode) < 0) {
  1.1075 +                return -1;
  1.1076 +            }
  1.1077 +        }
  1.1078 +        if (window->flags & SDL_WINDOW_FULLSCREEN) {
  1.1079 +            SDL_OnWindowResized(window);
  1.1080 +        }
  1.1081 +    }
  1.1082 +    return 0;
  1.1083  }
  1.1084  
  1.1085  int
  1.1086  SDL_GetFullscreenDisplayMode(SDL_DisplayMode * mode)
  1.1087  {
  1.1088 -	if (!_this) {
  1.1089 -		SDL_UninitializedVideo();
  1.1090 -		return -1;
  1.1091 -	}
  1.1092 -	if (mode) {
  1.1093 -		*mode = SDL_CurrentDisplay.fullscreen_mode;
  1.1094 -	}
  1.1095 -	return 0;
  1.1096 +    if (!_this) {
  1.1097 +        SDL_UninitializedVideo();
  1.1098 +        return -1;
  1.1099 +    }
  1.1100 +    if (mode) {
  1.1101 +        *mode = SDL_CurrentDisplay.fullscreen_mode;
  1.1102 +    }
  1.1103 +    return 0;
  1.1104  }
  1.1105  
  1.1106  int
  1.1107  SDL_SetDisplayPalette(const SDL_Color * colors, int firstcolor, int ncolors)
  1.1108  {
  1.1109 -	SDL_Palette    *palette;
  1.1110 -	int             status = 0;
  1.1111 +    SDL_Palette *palette;
  1.1112 +    int status = 0;
  1.1113  
  1.1114 -	if (!_this) {
  1.1115 -		SDL_UninitializedVideo();
  1.1116 -		return -1;
  1.1117 -	}
  1.1118 -	palette = SDL_CurrentDisplay.palette;
  1.1119 -	if (!palette) {
  1.1120 -		SDL_SetError("Display mode does not have a palette");
  1.1121 -		return -1;
  1.1122 -	}
  1.1123 -	status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
  1.1124 +    if (!_this) {
  1.1125 +        SDL_UninitializedVideo();
  1.1126 +        return -1;
  1.1127 +    }
  1.1128 +    palette = SDL_CurrentDisplay.palette;
  1.1129 +    if (!palette) {
  1.1130 +        SDL_SetError("Display mode does not have a palette");
  1.1131 +        return -1;
  1.1132 +    }
  1.1133 +    status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
  1.1134  
  1.1135 -	if (_this->SetDisplayPalette) {
  1.1136 -		if (_this->SetDisplayPalette(_this, palette) < 0) {
  1.1137 -			status = -1;
  1.1138 -		}
  1.1139 -	}
  1.1140 -	return status;
  1.1141 +    if (_this->SetDisplayPalette) {
  1.1142 +        if (_this->SetDisplayPalette(_this, palette) < 0) {
  1.1143 +            status = -1;
  1.1144 +        }
  1.1145 +    }
  1.1146 +    return status;
  1.1147  }
  1.1148  
  1.1149  int
  1.1150  SDL_GetDisplayPalette(SDL_Color * colors, int firstcolor, int ncolors)
  1.1151  {
  1.1152 -	SDL_Palette    *palette;
  1.1153 +    SDL_Palette *palette;
  1.1154  
  1.1155 -	if (!_this) {
  1.1156 -		SDL_UninitializedVideo();
  1.1157 -		return -1;
  1.1158 -	}
  1.1159 -	palette = SDL_CurrentDisplay.palette;
  1.1160 -	if (!palette->ncolors) {
  1.1161 -		SDL_SetError("Display mode does not have a palette");
  1.1162 -		return -1;
  1.1163 -	}
  1.1164 -	if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
  1.1165 -		SDL_SetError("Palette indices are out of range");
  1.1166 -		return -1;
  1.1167 -	}
  1.1168 -	SDL_memcpy(colors, &palette->colors[firstcolor],
  1.1169 -		   ncolors * sizeof(*colors));
  1.1170 -	return 0;
  1.1171 +    if (!_this) {
  1.1172 +        SDL_UninitializedVideo();
  1.1173 +        return -1;
  1.1174 +    }
  1.1175 +    palette = SDL_CurrentDisplay.palette;
  1.1176 +    if (!palette->ncolors) {
  1.1177 +        SDL_SetError("Display mode does not have a palette");
  1.1178 +        return -1;
  1.1179 +    }
  1.1180 +    if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
  1.1181 +        SDL_SetError("Palette indices are out of range");
  1.1182 +        return -1;
  1.1183 +    }
  1.1184 +    SDL_memcpy(colors, &palette->colors[firstcolor],
  1.1185 +               ncolors * sizeof(*colors));
  1.1186 +    return 0;
  1.1187  }
  1.1188  
  1.1189  SDL_WindowID
  1.1190  SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
  1.1191  {
  1.1192 -	const Uint32    allowed_flags = (SDL_WINDOW_FULLSCREEN |
  1.1193 -					 SDL_WINDOW_OPENGL |
  1.1194 -					 SDL_WINDOW_BORDERLESS |
  1.1195 -					 SDL_WINDOW_RESIZABLE);
  1.1196 -	SDL_VideoDisplay *display;
  1.1197 -	SDL_Window      window;
  1.1198 -	int             num_windows;
  1.1199 -	SDL_Window     *windows;
  1.1200 +    const Uint32 allowed_flags = (SDL_WINDOW_FULLSCREEN |
  1.1201 +                                  SDL_WINDOW_OPENGL |
  1.1202 +                                  SDL_WINDOW_BORDERLESS |
  1.1203 +                                  SDL_WINDOW_RESIZABLE);
  1.1204 +    SDL_VideoDisplay *display;
  1.1205 +    SDL_Window window;
  1.1206 +    int num_windows;
  1.1207 +    SDL_Window *windows;
  1.1208  
  1.1209 -	if (!_this) {
  1.1210 -		SDL_UninitializedVideo();
  1.1211 -		return 0;
  1.1212 -	}
  1.1213 -	if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
  1.1214 -		SDL_SetError("No OpenGL support in video driver");
  1.1215 -		return 0;
  1.1216 -	}
  1.1217 -	/* Fullscreen windows don't have any window decorations */
  1.1218 -	if (flags & SDL_WINDOW_FULLSCREEN) {
  1.1219 -		flags |= SDL_WINDOW_BORDERLESS;
  1.1220 -		flags &= ~SDL_WINDOW_RESIZABLE;
  1.1221 -	}
  1.1222 -	SDL_zero(window);
  1.1223 -	window.id = _this->next_object_id++;
  1.1224 -	window.x = x;
  1.1225 -	window.y = y;
  1.1226 -	window.w = w;
  1.1227 -	window.h = h;
  1.1228 -	window.flags = (flags & allowed_flags);
  1.1229 -	window.display = _this->current_display;
  1.1230 +    if (!_this) {
  1.1231 +        SDL_UninitializedVideo();
  1.1232 +        return 0;
  1.1233 +    }
  1.1234 +    if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
  1.1235 +        SDL_SetError("No OpenGL support in video driver");
  1.1236 +        return 0;
  1.1237 +    }
  1.1238 +    /* Fullscreen windows don't have any window decorations */
  1.1239 +    if (flags & SDL_WINDOW_FULLSCREEN) {
  1.1240 +        flags |= SDL_WINDOW_BORDERLESS;
  1.1241 +        flags &= ~SDL_WINDOW_RESIZABLE;
  1.1242 +    }
  1.1243 +    SDL_zero(window);
  1.1244 +    window.id = _this->next_object_id++;
  1.1245 +    window.x = x;
  1.1246 +    window.y = y;
  1.1247 +    window.w = w;
  1.1248 +    window.h = h;
  1.1249 +    window.flags = (flags & allowed_flags);
  1.1250 +    window.display = _this->current_display;
  1.1251  
  1.1252 -	if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) {
  1.1253 -		return 0;
  1.1254 -	}
  1.1255 -	display = &SDL_CurrentDisplay;
  1.1256 -	num_windows = display->num_windows;
  1.1257 -	windows =
  1.1258 -		SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
  1.1259 -	if (!windows) {
  1.1260 -		if (_this->DestroyWindow) {
  1.1261 -			_this->DestroyWindow(_this, &window);
  1.1262 -		}
  1.1263 -		return 0;
  1.1264 -	}
  1.1265 -	windows[num_windows] = window;
  1.1266 -	display->windows = windows;
  1.1267 -	display->num_windows++;
  1.1268 +    if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) {
  1.1269 +        return 0;
  1.1270 +    }
  1.1271 +    display = &SDL_CurrentDisplay;
  1.1272 +    num_windows = display->num_windows;
  1.1273 +    windows =
  1.1274 +        SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
  1.1275 +    if (!windows) {
  1.1276 +        if (_this->DestroyWindow) {
  1.1277 +            _this->DestroyWindow(_this, &window);
  1.1278 +        }
  1.1279 +        return 0;
  1.1280 +    }
  1.1281 +    windows[num_windows] = window;
  1.1282 +    display->windows = windows;
  1.1283 +    display->num_windows++;
  1.1284  
  1.1285 -	if (title) {
  1.1286 -		SDL_SetWindowTitle(window.id, title);
  1.1287 -	}
  1.1288 -	if (flags & SDL_WINDOW_MAXIMIZED) {
  1.1289 -		SDL_MaximizeWindow(window.id);
  1.1290 -	}
  1.1291 -	if (flags & SDL_WINDOW_MINIMIZED) {
  1.1292 -		SDL_MinimizeWindow(window.id);
  1.1293 -	}
  1.1294 -	if (flags & SDL_WINDOW_SHOWN) {
  1.1295 -		SDL_ShowWindow(window.id);
  1.1296 -	}
  1.1297 -	if (flags & SDL_WINDOW_INPUT_GRABBED) {
  1.1298 -		SDL_SetWindowGrab(window.id, 1);
  1.1299 -	}
  1.1300 -	return window.id;
  1.1301 +    if (title) {
  1.1302 +        SDL_SetWindowTitle(window.id, title);
  1.1303 +    }
  1.1304 +    if (flags & SDL_WINDOW_MAXIMIZED) {
  1.1305 +        SDL_MaximizeWindow(window.id);
  1.1306 +    }
  1.1307 +    if (flags & SDL_WINDOW_MINIMIZED) {
  1.1308 +        SDL_MinimizeWindow(window.id);
  1.1309 +    }
  1.1310 +    if (flags & SDL_WINDOW_SHOWN) {
  1.1311 +        SDL_ShowWindow(window.id);
  1.1312 +    }
  1.1313 +    if (flags & SDL_WINDOW_INPUT_GRABBED) {
  1.1314 +        SDL_SetWindowGrab(window.id, 1);
  1.1315 +    }
  1.1316 +    return window.id;
  1.1317  }
  1.1318  
  1.1319  SDL_WindowID
  1.1320  SDL_CreateWindowFrom(const void *data)
  1.1321  {
  1.1322 -	SDL_VideoDisplay *display;
  1.1323 -	SDL_Window      window;
  1.1324 -	int             num_windows;
  1.1325 -	SDL_Window     *windows;
  1.1326 +    SDL_VideoDisplay *display;
  1.1327 +    SDL_Window window;
  1.1328 +    int num_windows;
  1.1329 +    SDL_Window *windows;
  1.1330  
  1.1331 -	if (!_this) {
  1.1332 -		SDL_UninitializedVideo();
  1.1333 -		return (0);
  1.1334 -	}
  1.1335 -	SDL_zero(window);
  1.1336 -	window.id = _this->next_object_id++;
  1.1337 -	window.display = _this->current_display;
  1.1338 +    if (!_this) {
  1.1339 +        SDL_UninitializedVideo();
  1.1340 +        return (0);
  1.1341 +    }
  1.1342 +    SDL_zero(window);
  1.1343 +    window.id = _this->next_object_id++;
  1.1344 +    window.display = _this->current_display;
  1.1345  
  1.1346 -	if (!_this->CreateWindowFrom ||
  1.1347 -	    _this->CreateWindowFrom(_this, &window, data) < 0) {
  1.1348 -		return 0;
  1.1349 -	}
  1.1350 -	display = &SDL_CurrentDisplay;
  1.1351 -	num_windows = display->num_windows;
  1.1352 -	windows =
  1.1353 -		SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
  1.1354 -	if (!windows) {
  1.1355 -		if (_this->DestroyWindow) {
  1.1356 -			_this->DestroyWindow(_this, &window);
  1.1357 -		}
  1.1358 -		if (window.title) {
  1.1359 -			SDL_free(window.title);
  1.1360 -		}
  1.1361 -		return 0;
  1.1362 -	}
  1.1363 -	windows[num_windows] = window;
  1.1364 -	display->windows = windows;
  1.1365 -	display->num_windows++;
  1.1366 +    if (!_this->CreateWindowFrom ||
  1.1367 +        _this->CreateWindowFrom(_this, &window, data) < 0) {
  1.1368 +        return 0;
  1.1369 +    }
  1.1370 +    display = &SDL_CurrentDisplay;
  1.1371 +    num_windows = display->num_windows;
  1.1372 +    windows =
  1.1373 +        SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
  1.1374 +    if (!windows) {
  1.1375 +        if (_this->DestroyWindow) {
  1.1376 +            _this->DestroyWindow(_this, &window);
  1.1377 +        }
  1.1378 +        if (window.title) {
  1.1379 +            SDL_free(window.title);
  1.1380 +        }
  1.1381 +        return 0;
  1.1382 +    }
  1.1383 +    windows[num_windows] = window;
  1.1384 +    display->windows = windows;
  1.1385 +    display->num_windows++;
  1.1386  
  1.1387 -	return window.id;
  1.1388 +    return window.id;
  1.1389  }
  1.1390  
  1.1391  int
  1.1392  SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
  1.1393  {
  1.1394 -	char           *title = window->title;
  1.1395 +    char *title = window->title;
  1.1396  
  1.1397 -	if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
  1.1398 -		SDL_SetError("No OpenGL support in video driver");
  1.1399 -		return -1;
  1.1400 -	}
  1.1401 -	if (_this->DestroyWindow) {
  1.1402 -		_this->DestroyWindow(_this, window);
  1.1403 -	}
  1.1404 -	window->title = NULL;
  1.1405 -	window->flags =
  1.1406 -		(flags &
  1.1407 -	  ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_SHOWN |
  1.1408 -	    SDL_WINDOW_INPUT_GRABBED));
  1.1409 +    if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
  1.1410 +        SDL_SetError("No OpenGL support in video driver");
  1.1411 +        return -1;
  1.1412 +    }
  1.1413 +    if (_this->DestroyWindow) {
  1.1414 +        _this->DestroyWindow(_this, window);
  1.1415 +    }
  1.1416 +    window->title = NULL;
  1.1417 +    window->flags =
  1.1418 +        (flags &
  1.1419 +         ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_SHOWN |
  1.1420 +           SDL_WINDOW_INPUT_GRABBED));
  1.1421  
  1.1422 -	if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
  1.1423 -		return -1;
  1.1424 -	}
  1.1425 -	if (title) {
  1.1426 -		SDL_SetWindowTitle(window->id, title);
  1.1427 -		SDL_free(title);
  1.1428 -	}
  1.1429 -	if (flags & SDL_WINDOW_MAXIMIZED) {
  1.1430 -		SDL_MaximizeWindow(window->id);
  1.1431 -	}
  1.1432 -	if (flags & SDL_WINDOW_MINIMIZED) {
  1.1433 -		SDL_MinimizeWindow(window->id);
  1.1434 -	}
  1.1435 -	if (flags & SDL_WINDOW_SHOWN) {
  1.1436 -		SDL_ShowWindow(window->id);
  1.1437 -	}
  1.1438 -	if (flags & SDL_WINDOW_INPUT_GRABBED) {
  1.1439 -		SDL_SetWindowGrab(window->id, 1);
  1.1440 -	}
  1.1441 -	return 0;
  1.1442 +    if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
  1.1443 +        return -1;
  1.1444 +    }
  1.1445 +    if (title) {
  1.1446 +        SDL_SetWindowTitle(window->id, title);
  1.1447 +        SDL_free(title);
  1.1448 +    }
  1.1449 +    if (flags & SDL_WINDOW_MAXIMIZED) {
  1.1450 +        SDL_MaximizeWindow(window->id);
  1.1451 +    }
  1.1452 +    if (flags & SDL_WINDOW_MINIMIZED) {
  1.1453 +        SDL_MinimizeWindow(window->id);
  1.1454 +    }
  1.1455 +    if (flags & SDL_WINDOW_SHOWN) {
  1.1456 +        SDL_ShowWindow(window->id);
  1.1457 +    }
  1.1458 +    if (flags & SDL_WINDOW_INPUT_GRABBED) {
  1.1459 +        SDL_SetWindowGrab(window->id, 1);
  1.1460 +    }
  1.1461 +    return 0;
  1.1462  }
  1.1463  
  1.1464 -SDL_Window     *
  1.1465 +SDL_Window *
  1.1466  SDL_GetWindowFromID(SDL_WindowID windowID)
  1.1467  {
  1.1468 -	int             i, j;
  1.1469 +    int i, j;
  1.1470  
  1.1471 -	if (!_this) {
  1.1472 -		SDL_UninitializedVideo();
  1.1473 -		return NULL;
  1.1474 -	}
  1.1475 -	for (i = 0; i < _this->num_displays; ++i) {
  1.1476 -		SDL_VideoDisplay *display = &_this->displays[i];
  1.1477 -		for (j = 0; j < display->num_windows; ++j) {
  1.1478 -			SDL_Window     *window = &display->windows[j];
  1.1479 -			if (window->id == windowID) {
  1.1480 -				return window;
  1.1481 -			}
  1.1482 -		}
  1.1483 -	}
  1.1484 -	return NULL;
  1.1485 +    if (!_this) {
  1.1486 +        SDL_UninitializedVideo();
  1.1487 +        return NULL;
  1.1488 +    }
  1.1489 +    for (i = 0; i < _this->num_displays; ++i) {
  1.1490 +        SDL_VideoDisplay *display = &_this->displays[i];
  1.1491 +        for (j = 0; j < display->num_windows; ++j) {
  1.1492 +            SDL_Window *window = &display->windows[j];
  1.1493 +            if (window->id == windowID) {
  1.1494 +                return window;
  1.1495 +            }
  1.1496 +        }
  1.1497 +    }
  1.1498 +    return NULL;
  1.1499  }
  1.1500  
  1.1501  SDL_VideoDisplay *
  1.1502  SDL_GetDisplayFromWindow(SDL_Window * window)
  1.1503  {
  1.1504 -	if (!_this) {
  1.1505 -		SDL_UninitializedVideo();
  1.1506 -		return NULL;
  1.1507 -	}
  1.1508 -	if (!window) {
  1.1509 -		return NULL;
  1.1510 -	}
  1.1511 -	return &_this->displays[window->display];
  1.1512 +    if (!_this) {
  1.1513 +        SDL_UninitializedVideo();
  1.1514 +        return NULL;
  1.1515 +    }
  1.1516 +    if (!window) {
  1.1517 +        return NULL;
  1.1518 +    }
  1.1519 +    return &_this->displays[window->display];
  1.1520  }
  1.1521  
  1.1522  Uint32
  1.1523  SDL_GetWindowFlags(SDL_WindowID windowID)
  1.1524  {
  1.1525 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1526 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1527  
  1.1528 -	if (!window) {
  1.1529 -		return 0;
  1.1530 -	}
  1.1531 -	return window->flags;
  1.1532 +    if (!window) {
  1.1533 +        return 0;
  1.1534 +    }
  1.1535 +    return window->flags;
  1.1536  }
  1.1537  
  1.1538  void
  1.1539  SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
  1.1540  {
  1.1541 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1542 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1543  
  1.1544 -	if (!window || title == window->title) {
  1.1545 -		return;
  1.1546 -	}
  1.1547 -	if (window->title) {
  1.1548 -		SDL_free(window->title);
  1.1549 -	}
  1.1550 -	if (title) {
  1.1551 -		window->title = SDL_strdup(title);
  1.1552 -	} else {
  1.1553 -		window->title = NULL;
  1.1554 -	}
  1.1555 +    if (!window || title == window->title) {
  1.1556 +        return;
  1.1557 +    }
  1.1558 +    if (window->title) {
  1.1559 +        SDL_free(window->title);
  1.1560 +    }
  1.1561 +    if (title) {
  1.1562 +        window->title = SDL_strdup(title);
  1.1563 +    } else {
  1.1564 +        window->title = NULL;
  1.1565 +    }
  1.1566  
  1.1567 -	if (_this->SetWindowTitle) {
  1.1568 -		_this->SetWindowTitle(_this, window);
  1.1569 -	}
  1.1570 +    if (_this->SetWindowTitle) {
  1.1571 +        _this->SetWindowTitle(_this, window);
  1.1572 +    }
  1.1573  }
  1.1574  
  1.1575 -const char     *
  1.1576 +const char *
  1.1577  SDL_GetWindowTitle(SDL_WindowID windowID)
  1.1578  {
  1.1579 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1580 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1581  
  1.1582 -	if (!window) {
  1.1583 -		return NULL;
  1.1584 -	}
  1.1585 -	return window->title;
  1.1586 +    if (!window) {
  1.1587 +        return NULL;
  1.1588 +    }
  1.1589 +    return window->title;
  1.1590  }
  1.1591  
  1.1592  void
  1.1593  SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
  1.1594  {
  1.1595 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1596 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1597  
  1.1598 -	if (!window) {
  1.1599 -		return;
  1.1600 -	}
  1.1601 -	window->userdata = userdata;
  1.1602 +    if (!window) {
  1.1603 +        return;
  1.1604 +    }
  1.1605 +    window->userdata = userdata;
  1.1606  }
  1.1607  
  1.1608 -void           *
  1.1609 +void *
  1.1610  SDL_GetWindowData(SDL_WindowID windowID)
  1.1611  {
  1.1612 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1613 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1614  
  1.1615 -	if (!window) {
  1.1616 -		return NULL;
  1.1617 -	}
  1.1618 -	return window->userdata;
  1.1619 +    if (!window) {
  1.1620 +        return NULL;
  1.1621 +    }
  1.1622 +    return window->userdata;
  1.1623  }
  1.1624  
  1.1625  void
  1.1626  SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
  1.1627  {
  1.1628 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1629 -	SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.1630 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1631 +    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.1632  
  1.1633 -	if (!window) {
  1.1634 -		return;
  1.1635 -	}
  1.1636 -	if (x == SDL_WINDOWPOS_CENTERED) {
  1.1637 -		window->x = (display->current_mode.w - window->w) / 2;
  1.1638 -	} else if (x != SDL_WINDOWPOS_UNDEFINED) {
  1.1639 -		window->x = x;
  1.1640 -	}
  1.1641 -	if (y == SDL_WINDOWPOS_CENTERED) {
  1.1642 -		window->y = (display->current_mode.h - window->h) / 2;
  1.1643 -	} else if (y != SDL_WINDOWPOS_UNDEFINED) {
  1.1644 -		window->y = y;
  1.1645 -	}
  1.1646 -	if (_this->SetWindowPosition) {
  1.1647 -		_this->SetWindowPosition(_this, window);
  1.1648 -	}
  1.1649 +    if (!window) {
  1.1650 +        return;
  1.1651 +    }
  1.1652 +    if (x == SDL_WINDOWPOS_CENTERED) {
  1.1653 +        window->x = (display->current_mode.w - window->w) / 2;
  1.1654 +    } else if (x != SDL_WINDOWPOS_UNDEFINED) {
  1.1655 +        window->x = x;
  1.1656 +    }
  1.1657 +    if (y == SDL_WINDOWPOS_CENTERED) {
  1.1658 +        window->y = (display->current_mode.h - window->h) / 2;
  1.1659 +    } else if (y != SDL_WINDOWPOS_UNDEFINED) {
  1.1660 +        window->y = y;
  1.1661 +    }
  1.1662 +    if (_this->SetWindowPosition) {
  1.1663 +        _this->SetWindowPosition(_this, window);
  1.1664 +    }
  1.1665  }
  1.1666  
  1.1667  void
  1.1668  SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
  1.1669  {
  1.1670 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1671 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1672  
  1.1673 -	if (!window) {
  1.1674 -		return;
  1.1675 -	}
  1.1676 -	if (x) {
  1.1677 -		*x = window->x;
  1.1678 -	}
  1.1679 -	if (y) {
  1.1680 -		*y = window->y;
  1.1681 -	}
  1.1682 +    if (!window) {
  1.1683 +        return;
  1.1684 +    }
  1.1685 +    if (x) {
  1.1686 +        *x = window->x;
  1.1687 +    }
  1.1688 +    if (y) {
  1.1689 +        *y = window->y;
  1.1690 +    }
  1.1691  }
  1.1692  
  1.1693  void
  1.1694  SDL_SetWindowSize(SDL_WindowID windowID, int w, int h)
  1.1695  {
  1.1696 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1697 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1698  
  1.1699 -	if (!window) {
  1.1700 -		return;
  1.1701 -	}
  1.1702 -	window->w = w;
  1.1703 -	window->h = h;
  1.1704 +    if (!window) {
  1.1705 +        return;
  1.1706 +    }
  1.1707 +    window->w = w;
  1.1708 +    window->h = h;
  1.1709  
  1.1710 -	if (_this->SetWindowSize) {
  1.1711 -		_this->SetWindowSize(_this, window);
  1.1712 -	}
  1.1713 +    if (_this->SetWindowSize) {
  1.1714 +        _this->SetWindowSize(_this, window);
  1.1715 +    }
  1.1716  }
  1.1717  
  1.1718  void
  1.1719  SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *h)
  1.1720  {
  1.1721 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1722 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1723  
  1.1724 -	if (!window) {
  1.1725 -		return;
  1.1726 -	}
  1.1727 -	if (w) {
  1.1728 -		*w = window->w;
  1.1729 -	}
  1.1730 -	if (h) {
  1.1731 -		*h = window->h;
  1.1732 -	}
  1.1733 +    if (!window) {
  1.1734 +        return;
  1.1735 +    }
  1.1736 +    if (w) {
  1.1737 +        *w = window->w;
  1.1738 +    }
  1.1739 +    if (h) {
  1.1740 +        *h = window->h;
  1.1741 +    }
  1.1742  }
  1.1743  
  1.1744  void
  1.1745  SDL_ShowWindow(SDL_WindowID windowID)
  1.1746  {
  1.1747 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1748 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1749  
  1.1750 -	if (!window || (window->flags & SDL_WINDOW_SHOWN)) {
  1.1751 -		return;
  1.1752 -	}
  1.1753 -	SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0);
  1.1754 +    if (!window || (window->flags & SDL_WINDOW_SHOWN)) {
  1.1755 +        return;
  1.1756 +    }
  1.1757 +    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0);
  1.1758  
  1.1759 -	if (_this->ShowWindow) {
  1.1760 -		_this->ShowWindow(_this, window);
  1.1761 -	}
  1.1762 +    if (_this->ShowWindow) {
  1.1763 +        _this->ShowWindow(_this, window);
  1.1764 +    }
  1.1765  }
  1.1766  
  1.1767  void
  1.1768  SDL_HideWindow(SDL_WindowID windowID)
  1.1769  {
  1.1770 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1771 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1772  
  1.1773 -	if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
  1.1774 -		return;
  1.1775 -	}
  1.1776 -	SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0);
  1.1777 +    if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
  1.1778 +        return;
  1.1779 +    }
  1.1780 +    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0);
  1.1781  
  1.1782 -	if (_this->HideWindow) {
  1.1783 -		_this->HideWindow(_this, window);
  1.1784 -	}
  1.1785 +    if (_this->HideWindow) {
  1.1786 +        _this->HideWindow(_this, window);
  1.1787 +    }
  1.1788  }
  1.1789  
  1.1790  void
  1.1791  SDL_RaiseWindow(SDL_WindowID windowID)
  1.1792  {
  1.1793 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1794 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1795  
  1.1796 -	if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
  1.1797 -		return;
  1.1798 -	}
  1.1799 -	if (_this->RaiseWindow) {
  1.1800 -		_this->RaiseWindow(_this, window);
  1.1801 -	}
  1.1802 +    if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
  1.1803 +        return;
  1.1804 +    }
  1.1805 +    if (_this->RaiseWindow) {
  1.1806 +        _this->RaiseWindow(_this, window);
  1.1807 +    }
  1.1808  }
  1.1809  
  1.1810  void
  1.1811  SDL_MaximizeWindow(SDL_WindowID windowID)
  1.1812  {
  1.1813 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1814 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1815  
  1.1816 -	if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) {
  1.1817 -		return;
  1.1818 -	}
  1.1819 -	SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
  1.1820 +    if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) {
  1.1821 +        return;
  1.1822 +    }
  1.1823 +    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
  1.1824  
  1.1825 -	if (_this->MaximizeWindow) {
  1.1826 -		_this->MaximizeWindow(_this, window);
  1.1827 -	}
  1.1828 +    if (_this->MaximizeWindow) {
  1.1829 +        _this->MaximizeWindow(_this, window);
  1.1830 +    }
  1.1831  }
  1.1832  
  1.1833  void
  1.1834  SDL_MinimizeWindow(SDL_WindowID windowID)
  1.1835  {
  1.1836 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1837 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1838  
  1.1839 -	if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) {
  1.1840 -		return;
  1.1841 -	}
  1.1842 -	SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
  1.1843 +    if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) {
  1.1844 +        return;
  1.1845 +    }
  1.1846 +    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
  1.1847  
  1.1848 -	if (_this->MinimizeWindow) {
  1.1849 -		_this->MinimizeWindow(_this, window);
  1.1850 -	}
  1.1851 +    if (_this->MinimizeWindow) {
  1.1852 +        _this->MinimizeWindow(_this, window);
  1.1853 +    }
  1.1854  }
  1.1855  
  1.1856  void
  1.1857  SDL_RestoreWindow(SDL_WindowID windowID)
  1.1858  {
  1.1859 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1860 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1861  
  1.1862 -	if (!window
  1.1863 -	|| (window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
  1.1864 -		return;
  1.1865 -	}
  1.1866 -	SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0);
  1.1867 +    if (!window
  1.1868 +        || (window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
  1.1869 +        return;
  1.1870 +    }
  1.1871 +    SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0);
  1.1872  
  1.1873 -	if (_this->RestoreWindow) {
  1.1874 -		_this->RestoreWindow(_this, window);
  1.1875 -	}
  1.1876 +    if (_this->RestoreWindow) {
  1.1877 +        _this->RestoreWindow(_this, window);
  1.1878 +    }
  1.1879  }
  1.1880  
  1.1881  int
  1.1882  SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
  1.1883  {
  1.1884 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1885 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1886  
  1.1887 -	if (!window) {
  1.1888 -		return -1;
  1.1889 -	}
  1.1890 -	if (fullscreen) {
  1.1891 -		fullscreen = SDL_WINDOW_FULLSCREEN;
  1.1892 -	}
  1.1893 -	if ((window->flags & SDL_WINDOW_FULLSCREEN) == fullscreen) {
  1.1894 -		return 0;
  1.1895 -	}
  1.1896 -	if (fullscreen) {
  1.1897 -		window->flags |= SDL_WINDOW_FULLSCREEN;
  1.1898 +    if (!window) {
  1.1899 +        return -1;
  1.1900 +    }
  1.1901 +    if (fullscreen) {
  1.1902 +        fullscreen = SDL_WINDOW_FULLSCREEN;
  1.1903 +    }
  1.1904 +    if ((window->flags & SDL_WINDOW_FULLSCREEN) == fullscreen) {
  1.1905 +        return 0;
  1.1906 +    }
  1.1907 +    if (fullscreen) {
  1.1908 +        window->flags |= SDL_WINDOW_FULLSCREEN;
  1.1909  
  1.1910 -		if (FULLSCREEN_VISIBLE(window)) {
  1.1911 -			SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.1912 +        if (FULLSCREEN_VISIBLE(window)) {
  1.1913 +            SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.1914  
  1.1915 -			/* Hide any other fullscreen windows */
  1.1916 -			int             i;
  1.1917 -			for (i = 0; i < display->num_windows; ++i) {
  1.1918 -				SDL_Window     *other = &display->windows[i];
  1.1919 -				if (other->id != windowID && FULLSCREEN_VISIBLE(other)) {
  1.1920 -					SDL_MinimizeWindow(other->id);
  1.1921 -				}
  1.1922 -			}
  1.1923 +            /* Hide any other fullscreen windows */
  1.1924 +            int i;
  1.1925 +            for (i = 0; i < display->num_windows; ++i) {
  1.1926 +                SDL_Window *other = &display->windows[i];
  1.1927 +                if (other->id != windowID && FULLSCREEN_VISIBLE(other)) {
  1.1928 +                    SDL_MinimizeWindow(other->id);
  1.1929 +                }
  1.1930 +            }
  1.1931  
  1.1932 -			SDL_SetDisplayMode(&display->fullscreen_mode);
  1.1933 -		}
  1.1934 -	} else {
  1.1935 -		window->flags &= ~SDL_WINDOW_FULLSCREEN;
  1.1936 +            SDL_SetDisplayMode(&display->fullscreen_mode);
  1.1937 +        }
  1.1938 +    } else {
  1.1939 +        window->flags &= ~SDL_WINDOW_FULLSCREEN;
  1.1940  
  1.1941 -		if (FULLSCREEN_VISIBLE(window)) {
  1.1942 -			SDL_SetDisplayMode(NULL);
  1.1943 -		}
  1.1944 -	}
  1.1945 -	return 0;
  1.1946 +        if (FULLSCREEN_VISIBLE(window)) {
  1.1947 +            SDL_SetDisplayMode(NULL);
  1.1948 +        }
  1.1949 +    }
  1.1950 +    return 0;
  1.1951  }
  1.1952  
  1.1953  void
  1.1954  SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
  1.1955  {
  1.1956 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1957 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1958  
  1.1959 -	if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
  1.1960 -		return;
  1.1961 -	}
  1.1962 -	if (mode) {
  1.1963 -		window->flags |= SDL_WINDOW_INPUT_GRABBED;
  1.1964 -	} else {
  1.1965 -		window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
  1.1966 -	}
  1.1967 +    if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
  1.1968 +        return;
  1.1969 +    }
  1.1970 +    if (mode) {
  1.1971 +        window->flags |= SDL_WINDOW_INPUT_GRABBED;
  1.1972 +    } else {
  1.1973 +        window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
  1.1974 +    }
  1.1975  
  1.1976 -	if ((window->flags & SDL_WINDOW_INPUT_FOCUS) && _this->SetWindowGrab) {
  1.1977 -		_this->SetWindowGrab(_this, window);
  1.1978 -	}
  1.1979 +    if ((window->flags & SDL_WINDOW_INPUT_FOCUS) && _this->SetWindowGrab) {
  1.1980 +        _this->SetWindowGrab(_this, window);
  1.1981 +    }
  1.1982  }
  1.1983  
  1.1984  int
  1.1985  SDL_GetWindowGrab(SDL_WindowID windowID)
  1.1986  {
  1.1987 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.1988 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.1989  
  1.1990 -	if (!window) {
  1.1991 -		return 0;
  1.1992 -	}
  1.1993 -	return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);
  1.1994 +    if (!window) {
  1.1995 +        return 0;
  1.1996 +    }
  1.1997 +    return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);
  1.1998  }
  1.1999  
  1.2000  void
  1.2001 @@ -1228,1041 +1228,1041 @@
  1.2002  void
  1.2003  SDL_OnWindowResized(SDL_Window * window)
  1.2004  {
  1.2005 -	SDL_Renderer   *renderer = window->renderer;
  1.2006 +    SDL_Renderer *renderer = window->renderer;
  1.2007  
  1.2008 -	if (renderer && renderer->DisplayModeChanged) {
  1.2009 -		renderer->DisplayModeChanged(renderer);
  1.2010 -	}
  1.2011 +    if (renderer && renderer->DisplayModeChanged) {
  1.2012 +        renderer->DisplayModeChanged(renderer);
  1.2013 +    }
  1.2014  }
  1.2015  
  1.2016  void
  1.2017  SDL_OnWindowFocusGained(SDL_Window * window)
  1.2018  {
  1.2019 -	SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.2020 +    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.2021  
  1.2022 -	if (window->flags & SDL_WINDOW_FULLSCREEN) {
  1.2023 -		SDL_SetDisplayMode(&display->fullscreen_mode);
  1.2024 -	}
  1.2025 -	if (display->gamma && _this->SetDisplayGammaRamp) {
  1.2026 -		_this->SetDisplayGammaRamp(_this, display->gamma);
  1.2027 -	}
  1.2028 -	if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
  1.2029 -		_this->SetWindowGrab(_this, window);
  1.2030 -	}
  1.2031 +    if (window->flags & SDL_WINDOW_FULLSCREEN) {
  1.2032 +        SDL_SetDisplayMode(&display->fullscreen_mode);
  1.2033 +    }
  1.2034 +    if (display->gamma && _this->SetDisplayGammaRamp) {
  1.2035 +        _this->SetDisplayGammaRamp(_this, display->gamma);
  1.2036 +    }
  1.2037 +    if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
  1.2038 +        _this->SetWindowGrab(_this, window);
  1.2039 +    }
  1.2040  }
  1.2041  
  1.2042  void
  1.2043  SDL_OnWindowFocusLost(SDL_Window * window)
  1.2044  {
  1.2045 -	SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.2046 +    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
  1.2047  
  1.2048 -	if (window->flags & SDL_WINDOW_FULLSCREEN) {
  1.2049 -		SDL_MinimizeWindow(window->id);
  1.2050 -		SDL_SetDisplayMode(NULL);
  1.2051 -	}
  1.2052 -	if (display->gamma && _this->SetDisplayGammaRamp) {
  1.2053 -		_this->SetDisplayGammaRamp(_this, display->saved_gamma);
  1.2054 -	}
  1.2055 -	if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
  1.2056 -		_this->SetWindowGrab(_this, window);
  1.2057 -	}
  1.2058 +    if (window->flags & SDL_WINDOW_FULLSCREEN) {
  1.2059 +        SDL_MinimizeWindow(window->id);
  1.2060 +        SDL_SetDisplayMode(NULL);
  1.2061 +    }
  1.2062 +    if (display->gamma && _this->SetDisplayGammaRamp) {
  1.2063 +        _this->SetDisplayGammaRamp(_this, display->saved_gamma);
  1.2064 +    }
  1.2065 +    if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
  1.2066 +        _this->SetWindowGrab(_this, window);
  1.2067 +    }
  1.2068  }
  1.2069  
  1.2070  SDL_WindowID
  1.2071  SDL_GetFocusWindow(void)
  1.2072  {
  1.2073 -	SDL_VideoDisplay *display;
  1.2074 -	int             i;
  1.2075 +    SDL_VideoDisplay *display;
  1.2076 +    int i;
  1.2077  
  1.2078 -	if (!_this) {
  1.2079 -		return 0;
  1.2080 -	}
  1.2081 -	display = &SDL_CurrentDisplay;
  1.2082 -	for (i = 0; i < display->num_windows; ++i) {
  1.2083 -		SDL_Window     *window = &display->windows[i];
  1.2084 +    if (!_this) {
  1.2085 +        return 0;
  1.2086 +    }
  1.2087 +    display = &SDL_CurrentDisplay;
  1.2088 +    for (i = 0; i < display->num_windows; ++i) {
  1.2089 +        SDL_Window *window = &display->windows[i];
  1.2090  
  1.2091 -		if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
  1.2092 -			return window->id;
  1.2093 -		}
  1.2094 -	}
  1.2095 -	return 0;
  1.2096 +        if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
  1.2097 +            return window->id;
  1.2098 +        }
  1.2099 +    }
  1.2100 +    return 0;
  1.2101  }
  1.2102  
  1.2103  void
  1.2104  SDL_DestroyWindow(SDL_WindowID windowID)
  1.2105  {
  1.2106 -	int             i, j;
  1.2107 +    int i, j;
  1.2108  
  1.2109 -	if (!_this) {
  1.2110 -		return;
  1.2111 -	}
  1.2112 -	/* Restore video mode, etc. */
  1.2113 -	SDL_SendWindowEvent(windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
  1.2114 +    if (!_this) {
  1.2115 +        return;
  1.2116 +    }
  1.2117 +    /* Restore video mode, etc. */
  1.2118 +    SDL_SendWindowEvent(windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
  1.2119  
  1.2120 -	for (i = 0; i < _this->num_displays; ++i) {
  1.2121 -		SDL_VideoDisplay *display = &_this->displays[i];
  1.2122 -		for (j = 0; j < display->num_windows; ++j) {
  1.2123 -			SDL_Window     *window = &display->windows[j];
  1.2124 -			if (window->id != windowID) {
  1.2125 -				continue;
  1.2126 -			}
  1.2127 -			if (window->title) {
  1.2128 -				SDL_free(window->title);
  1.2129 -				window->title = NULL;
  1.2130 -			}
  1.2131 -			if (window->renderer) {
  1.2132 -				SDL_DestroyRenderer(window->id);
  1.2133 -				window->renderer = NULL;
  1.2134 -			}
  1.2135 -			if (_this->DestroyWindow) {
  1.2136 -				_this->DestroyWindow(_this, window);
  1.2137 -			}
  1.2138 -			if (j != display->num_windows - 1) {
  1.2139 -				SDL_memcpy(&display->windows[i],
  1.2140 -					   &display->windows[i + 1],
  1.2141 -					   (display->num_windows - i - 1) * sizeof(*window));
  1.2142 -			}
  1.2143 -			--display->num_windows;
  1.2144 -			return;
  1.2145 -		}
  1.2146 -	}
  1.2147 +    for (i = 0; i < _this->num_displays; ++i) {
  1.2148 +        SDL_VideoDisplay *display = &_this->displays[i];
  1.2149 +        for (j = 0; j < display->num_windows; ++j) {
  1.2150 +            SDL_Window *window = &display->windows[j];
  1.2151 +            if (window->id != windowID) {
  1.2152 +                continue;
  1.2153 +            }
  1.2154 +            if (window->title) {
  1.2155 +                SDL_free(window->title);
  1.2156 +                window->title = NULL;
  1.2157 +            }
  1.2158 +            if (window->renderer) {
  1.2159 +                SDL_DestroyRenderer(window->id);
  1.2160 +                window->renderer = NULL;
  1.2161 +            }
  1.2162 +            if (_this->DestroyWindow) {
  1.2163 +                _this->DestroyWindow(_this, window);
  1.2164 +            }
  1.2165 +            if (j != display->num_windows - 1) {
  1.2166 +                SDL_memcpy(&display->windows[i],
  1.2167 +                           &display->windows[i + 1],
  1.2168 +                           (display->num_windows - i - 1) * sizeof(*window));
  1.2169 +            }
  1.2170 +            --display->num_windows;
  1.2171 +            return;
  1.2172 +        }
  1.2173 +    }
  1.2174  }
  1.2175  
  1.2176  void
  1.2177  SDL_AddRenderDriver(int displayIndex, const SDL_RenderDriver * driver)
  1.2178  {
  1.2179 -	SDL_VideoDisplay *display;
  1.2180 -	SDL_RenderDriver *render_drivers;
  1.2181 +    SDL_VideoDisplay *display;
  1.2182 +    SDL_RenderDriver *render_drivers;
  1.2183  
  1.2184 -	if (displayIndex >= _this->num_displays) {
  1.2185 -		return;
  1.2186 -	}
  1.2187 -	display = &_this->displays[displayIndex];
  1.2188 +    if (displayIndex >= _this->num_displays) {
  1.2189 +        return;
  1.2190 +    }
  1.2191 +    display = &_this->displays[displayIndex];
  1.2192  
  1.2193 -	render_drivers =
  1.2194 -		SDL_realloc(display->render_drivers,
  1.2195 -			    (display->num_render_drivers +
  1.2196 -			     1) * sizeof(*render_drivers));
  1.2197 -	if (render_drivers) {
  1.2198 -		render_drivers[display->num_render_drivers] = *driver;
  1.2199 -		display->render_drivers = render_drivers;
  1.2200 -		display->num_render_drivers++;
  1.2201 -	}
  1.2202 +    render_drivers =
  1.2203 +        SDL_realloc(display->render_drivers,
  1.2204 +                    (display->num_render_drivers +
  1.2205 +                     1) * sizeof(*render_drivers));
  1.2206 +    if (render_drivers) {
  1.2207 +        render_drivers[display->num_render_drivers] = *driver;
  1.2208 +        display->render_drivers = render_drivers;
  1.2209 +        display->num_render_drivers++;
  1.2210 +    }
  1.2211  }
  1.2212  
  1.2213  int
  1.2214  SDL_GetNumRenderDrivers(void)
  1.2215  {
  1.2216 -	if (_this) {
  1.2217 -		return SDL_CurrentDisplay.num_render_drivers;
  1.2218 -	}
  1.2219 -	return 0;
  1.2220 +    if (_this) {
  1.2221 +        return SDL_CurrentDisplay.num_render_drivers;
  1.2222 +    }
  1.2223 +    return 0;
  1.2224  }
  1.2225  
  1.2226  int
  1.2227  SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info)
  1.2228  {
  1.2229 -	if (!_this) {
  1.2230 -		SDL_UninitializedVideo();
  1.2231 -		return -1;
  1.2232 -	}
  1.2233 -	if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
  1.2234 -		SDL_SetError("index must be in the range of 0 - %d",
  1.2235 -			     SDL_GetNumRenderDrivers() - 1);
  1.2236 -		return -1;
  1.2237 -	}
  1.2238 -	*info = SDL_CurrentDisplay.render_drivers[index].info;
  1.2239 -	return 0;
  1.2240 +    if (!_this) {
  1.2241 +        SDL_UninitializedVideo();
  1.2242 +        return -1;
  1.2243 +    }
  1.2244 +    if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
  1.2245 +        SDL_SetError("index must be in the range of 0 - %d",
  1.2246 +                     SDL_GetNumRenderDrivers() - 1);
  1.2247 +        return -1;
  1.2248 +    }
  1.2249 +    *info = SDL_CurrentDisplay.render_drivers[index].info;
  1.2250 +    return 0;
  1.2251  }
  1.2252  
  1.2253  int
  1.2254  SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
  1.2255  {
  1.2256 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.2257 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.2258  
  1.2259 -	if (!window) {
  1.2260 -		return 0;
  1.2261 -	}
  1.2262 -	if (index < 0) {
  1.2263 -		const char     *override = SDL_getenv("SDL_VIDEO_RENDERER");
  1.2264 -		int             n = SDL_GetNumRenderDrivers();
  1.2265 -		for (index = 0; index < n; ++index) {
  1.2266 -			SDL_RenderDriver *driver =
  1.2267 -			&SDL_CurrentDisplay.render_drivers[index];
  1.2268 +    if (!window) {
  1.2269 +        return 0;
  1.2270 +    }
  1.2271 +    if (index < 0) {
  1.2272 +        const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
  1.2273 +        int n = SDL_GetNumRenderDrivers();
  1.2274 +        for (index = 0; index < n; ++index) {
  1.2275 +            SDL_RenderDriver *driver =
  1.2276 +                &SDL_CurrentDisplay.render_drivers[index];
  1.2277  
  1.2278 -			if (override) {
  1.2279 -				if (SDL_strcasecmp(override, driver->info.name) == 0) {
  1.2280 -					break;
  1.2281 -				}
  1.2282 -			} else {
  1.2283 -				if ((driver->info.flags & flags) == flags) {
  1.2284 -					break;
  1.2285 -				}
  1.2286 -			}
  1.2287 -		}
  1.2288 -		if (index == n) {
  1.2289 -			SDL_SetError("Couldn't find matching render driver");
  1.2290 -			return -1;
  1.2291 -		}
  1.2292 -	}
  1.2293 -	if (index >= SDL_GetNumRenderDrivers()) {
  1.2294 -		SDL_SetError("index must be -1 or in the range of 0 - %d",
  1.2295 -			     SDL_GetNumRenderDrivers() - 1);
  1.2296 -		return -1;
  1.2297 -	}
  1.2298 -	/* Free any existing renderer */
  1.2299 -	SDL_DestroyRenderer(windowID);
  1.2300 +            if (override) {
  1.2301 +                if (SDL_strcasecmp(override, driver->info.name) == 0) {
  1.2302 +                    break;
  1.2303 +                }
  1.2304 +            } else {
  1.2305 +                if ((driver->info.flags & flags) == flags) {
  1.2306 +                    break;
  1.2307 +                }
  1.2308 +            }
  1.2309 +        }
  1.2310 +        if (index == n) {
  1.2311 +            SDL_SetError("Couldn't find matching render driver");
  1.2312 +            return -1;
  1.2313 +        }
  1.2314 +    }
  1.2315 +    if (index >= SDL_GetNumRenderDrivers()) {
  1.2316 +        SDL_SetError("index must be -1 or in the range of 0 - %d",
  1.2317 +                     SDL_GetNumRenderDrivers() - 1);
  1.2318 +        return -1;
  1.2319 +    }
  1.2320 +    /* Free any existing renderer */
  1.2321 +    SDL_DestroyRenderer(windowID);
  1.2322  
  1.2323 -	/* Create a new renderer instance */
  1.2324 -	window->renderer = SDL_CurrentDisplay.render_drivers[index]
  1.2325 -		.CreateRenderer(window, flags);
  1.2326 -	SDL_SelectRenderer(window->id);
  1.2327 +    /* Create a new renderer instance */
  1.2328 +    window->renderer = SDL_CurrentDisplay.render_drivers[index]
  1.2329 +        .CreateRenderer(window, flags);
  1.2330 +    SDL_SelectRenderer(window->id);
  1.2331  
  1.2332 -	return 0;
  1.2333 +    return 0;
  1.2334  }
  1.2335  
  1.2336  int
  1.2337  SDL_SelectRenderer(SDL_WindowID windowID)
  1.2338  {
  1.2339 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.2340 -	SDL_Renderer   *renderer;
  1.2341 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.2342 +    SDL_Renderer *renderer;
  1.2343  
  1.2344 -	if (!window || !window->renderer) {
  1.2345 -		return -1;
  1.2346 -	}
  1.2347 -	renderer = window->renderer;
  1.2348 -	if (renderer && renderer->ActivateRenderer) {
  1.2349 -		if (renderer->ActivateRenderer(renderer) < 0) {
  1.2350 -			return -1;
  1.2351 -		}
  1.2352 -	}
  1.2353 -	SDL_CurrentDisplay.current_renderer = renderer;
  1.2354 -	return 0;
  1.2355 +    if (!window || !window->renderer) {
  1.2356 +        return -1;
  1.2357 +    }
  1.2358 +    renderer = window->renderer;
  1.2359 +    if (renderer && renderer->ActivateRenderer) {
  1.2360 +        if (renderer->ActivateRenderer(renderer) < 0) {
  1.2361 +            return -1;
  1.2362 +        }
  1.2363 +    }
  1.2364 +    SDL_CurrentDisplay.current_renderer = renderer;
  1.2365 +    return 0;
  1.2366  }
  1.2367  
  1.2368  int
  1.2369  SDL_GetRendererInfo(SDL_RendererInfo * info)
  1.2370  {
  1.2371 -	if (!_this) {
  1.2372 -		SDL_UninitializedVideo();
  1.2373 -		return -1;
  1.2374 -	}
  1.2375 -	if (!SDL_CurrentDisplay.current_renderer) {
  1.2376 -		SDL_SetError("There is no current renderer");
  1.2377 -		return -1;
  1.2378 -	}
  1.2379 -	*info = SDL_CurrentDisplay.current_renderer->info;
  1.2380 -	return 0;
  1.2381 +    if (!_this) {
  1.2382 +        SDL_UninitializedVideo();
  1.2383 +        return -1;
  1.2384 +    }
  1.2385 +    if (!SDL_CurrentDisplay.current_renderer) {
  1.2386 +        SDL_SetError("There is no current renderer");
  1.2387 +        return -1;
  1.2388 +    }
  1.2389 +    *info = SDL_CurrentDisplay.current_renderer->info;
  1.2390 +    return 0;
  1.2391  }
  1.2392  
  1.2393  SDL_TextureID
  1.2394  SDL_CreateTexture(Uint32 format, int access, int w, int h)
  1.2395  {
  1.2396 -	int             hash;
  1.2397 -	SDL_Renderer   *renderer;
  1.2398 -	SDL_Texture    *texture;
  1.2399 +    int hash;
  1.2400 +    SDL_Renderer *renderer;
  1.2401 +    SDL_Texture *texture;
  1.2402  
  1.2403 -	if (!_this) {
  1.2404 -		SDL_UninitializedVideo();
  1.2405 -		return 0;
  1.2406 -	}
  1.2407 -	renderer = SDL_CurrentDisplay.current_renderer;
  1.2408 -	if (!renderer || !renderer->CreateTexture) {
  1.2409 -		return 0;
  1.2410 -	}
  1.2411 -	texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
  1.2412 -	if (!texture) {
  1.2413 -		SDL_OutOfMemory();
  1.2414 -		return 0;
  1.2415 -	}
  1.2416 -	texture->id = _this->next_object_id++;
  1.2417 -	texture->format = format;
  1.2418 -	texture->access = access;
  1.2419 -	texture->w = w;
  1.2420 -	texture->h = h;
  1.2421 -	texture->r = 255;
  1.2422 -	texture->g = 255;
  1.2423 -	texture->b = 255;
  1.2424 -	texture->a = 255;
  1.2425 -	texture->renderer = renderer;
  1.2426 +    if (!_this) {
  1.2427 +        SDL_UninitializedVideo();
  1.2428 +        return 0;
  1.2429 +    }
  1.2430 +    renderer = SDL_CurrentDisplay.current_renderer;
  1.2431 +    if (!renderer || !renderer->CreateTexture) {
  1.2432 +        return 0;
  1.2433 +    }
  1.2434 +    texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
  1.2435 +    if (!texture) {
  1.2436 +        SDL_OutOfMemory();
  1.2437 +        return 0;
  1.2438 +    }
  1.2439 +    texture->id = _this->next_object_id++;
  1.2440 +    texture->format = format;
  1.2441 +    texture->access = access;
  1.2442 +    texture->w = w;
  1.2443 +    texture->h = h;
  1.2444 +    texture->r = 255;
  1.2445 +    texture->g = 255;
  1.2446 +    texture->b = 255;
  1.2447 +    texture->a = 255;
  1.2448 +    texture->renderer = renderer;
  1.2449  
  1.2450 -	if (renderer->CreateTexture(renderer, texture) < 0) {
  1.2451 -		if (renderer->DestroyTexture) {
  1.2452 -			renderer->DestroyTexture(renderer, texture);
  1.2453 -		}
  1.2454 -		SDL_free(texture);
  1.2455 -		return 0;
  1.2456 -	}
  1.2457 -	hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
  1.2458 -	texture->next = SDL_CurrentDisplay.textures[hash];
  1.2459 -	SDL_CurrentDisplay.textures[hash] = texture;
  1.2460 +    if (renderer->CreateTexture(renderer, texture) < 0) {
  1.2461 +        if (renderer->DestroyTexture) {
  1.2462 +            renderer->DestroyTexture(renderer, texture);
  1.2463 +        }
  1.2464 +        SDL_free(texture);
  1.2465 +        return 0;
  1.2466 +    }
  1.2467 +    hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
  1.2468 +    texture->next = SDL_CurrentDisplay.textures[hash];
  1.2469 +    SDL_CurrentDisplay.textures[hash] = texture;
  1.2470  
  1.2471 -	return texture->id;
  1.2472 +    return texture->id;
  1.2473  }
  1.2474  
  1.2475  SDL_TextureID
  1.2476  SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
  1.2477  {
  1.2478 -	SDL_TextureID   textureID;
  1.2479 -	SDL_PixelFormat *fmt;
  1.2480 -	int             bpp;
  1.2481 -	Uint32          Rmask, Gmask, Bmask, Amask;
  1.2482 +    SDL_TextureID textureID;
  1.2483 +    SDL_PixelFormat *fmt;
  1.2484 +    int bpp;
  1.2485 +    Uint32 Rmask, Gmask, Bmask, Amask;
  1.2486  
  1.2487 -	if (!surface) {
  1.2488 -		SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface");
  1.2489 -		return 0;
  1.2490 -	}
  1.2491 -	fmt = surface->format;
  1.2492 +    if (!surface) {
  1.2493 +        SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface");
  1.2494 +        return 0;
  1.2495 +    }
  1.2496 +    fmt = surface->format;
  1.2497  
  1.2498 -	if (format) {
  1.2499 -		if (!SDL_PixelFormatEnumToMasks
  1.2500 -		    (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
  1.2501 -			SDL_SetError("Unknown pixel format");
  1.2502 -			return 0;
  1.2503 -		}
  1.2504 -	} else {
  1.2505 -		if (surface->format->Amask
  1.2506 -		    || !(surface->map->info.flags &
  1.2507 -		    (SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) {
  1.2508 -			bpp = fmt->BitsPerPixel;
  1.2509 -			Rmask = fmt->Rmask;
  1.2510 -			Gmask = fmt->Gmask;
  1.2511 -			Bmask = fmt->Bmask;
  1.2512 -			Amask = fmt->Amask;
  1.2513 -		} else {
  1.2514 -			/* Need a format with alpha */
  1.2515 -			bpp = 32;
  1.2516 -			Rmask = 0x00FF0000;
  1.2517 -			Gmask = 0x0000FF00;
  1.2518 -			Bmask = 0x000000FF;
  1.2519 -			Amask = 0xFF000000;
  1.2520 -		}
  1.2521 -		format = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
  1.2522 -		if (!format) {
  1.2523 -			SDL_SetError("Unknown pixel format");
  1.2524 -			return 0;
  1.2525 -		}
  1.2526 -	}
  1.2527 +    if (format) {
  1.2528 +        if (!SDL_PixelFormatEnumToMasks
  1.2529 +            (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
  1.2530 +            SDL_SetError("Unknown pixel format");
  1.2531 +            return 0;
  1.2532 +        }
  1.2533 +    } else {
  1.2534 +        if (surface->format->Amask
  1.2535 +            || !(surface->map->info.flags &
  1.2536 +                 (SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) {
  1.2537 +            bpp = fmt->BitsPerPixel;
  1.2538 +            Rmask = fmt->Rmask;
  1.2539 +            Gmask = fmt->Gmask;
  1.2540 +            Bmask = fmt->Bmask;
  1.2541 +            Amask = fmt->Amask;
  1.2542 +        } else {
  1.2543 +            /* Need a format with alpha */
  1.2544 +            bpp = 32;
  1.2545 +            Rmask = 0x00FF0000;
  1.2546 +            Gmask = 0x0000FF00;
  1.2547 +            Bmask = 0x000000FF;
  1.2548 +            Amask = 0xFF000000;
  1.2549 +        }
  1.2550 +        format = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
  1.2551 +        if (!format) {
  1.2552 +            SDL_SetError("Unknown pixel format");
  1.2553 +            return 0;
  1.2554 +        }
  1.2555 +    }
  1.2556  
  1.2557 -	textureID =
  1.2558 -		SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
  1.2559 -				  surface->h);
  1.2560 -	if (!textureID) {
  1.2561 -		return 0;
  1.2562 -	}
  1.2563 -	if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask
  1.2564 -	    && Bmask == fmt->Bmask && Amask == fmt->Amask) {
  1.2565 -		if (SDL_MUSTLOCK(surface)) {
  1.2566 -			if (SDL_LockSurface(surface) < 0) {
  1.2567 -				SDL_DestroyTexture(textureID);
  1.2568 -				return 0;
  1.2569 -			}
  1.2570 -			SDL_UpdateTexture(textureID, NULL, surface->pixels,
  1.2571 -					  surface->pitch);
  1.2572 -			SDL_UnlockSurface(surface);
  1.2573 -		} else {
  1.2574 -			SDL_UpdateTexture(textureID, NULL, surface->pixels,
  1.2575 -					  surface->pitch);
  1.2576 -		}
  1.2577 -	} else {
  1.2578 -		SDL_PixelFormat *dst_fmt;
  1.2579 -		SDL_Surface    *dst = NULL;
  1.2580 +    textureID =
  1.2581 +        SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
  1.2582 +                          surface->h);
  1.2583 +    if (!textureID) {
  1.2584 +        return 0;
  1.2585 +    }
  1.2586 +    if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask
  1.2587 +        && Bmask == fmt->Bmask && Amask == fmt->Amask) {
  1.2588 +        if (SDL_MUSTLOCK(surface)) {
  1.2589 +            if (SDL_LockSurface(surface) < 0) {
  1.2590 +                SDL_DestroyTexture(textureID);
  1.2591 +                return 0;
  1.2592 +            }
  1.2593 +            SDL_UpdateTexture(textureID, NULL, surface->pixels,
  1.2594 +                              surface->pitch);
  1.2595 +            SDL_UnlockSurface(surface);
  1.2596 +        } else {
  1.2597 +            SDL_UpdateTexture(textureID, NULL, surface->pixels,
  1.2598 +                              surface->pitch);
  1.2599 +        }
  1.2600 +    } else {
  1.2601 +        SDL_PixelFormat *dst_fmt;
  1.2602 +        SDL_Surface *dst = NULL;
  1.2603  
  1.2604 -		/* Set up a destination surface for the texture update */
  1.2605 -		dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
  1.2606 -		if (dst_fmt) {
  1.2607 -			if (SDL_ISPIXELFORMAT_INDEXED(format)) {
  1.2608 -				dst_fmt->palette =
  1.2609 -					SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
  1.2610 -				if (dst_fmt->palette) {
  1.2611 -					/*
  1.2612 -					 * FIXME: Should we try to copy
  1.2613 -					 * fmt->palette?
  1.2614 -					 */
  1.2615 -					SDL_DitherColors(dst_fmt->palette->colors,
  1.2616 -						  SDL_BITSPERPIXEL(format));
  1.2617 -				}
  1.2618 -			}
  1.2619 -			dst = SDL_ConvertSurface(surface, dst_fmt, 0);
  1.2620 -			if (dst) {
  1.2621 -				SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
  1.2622 -				SDL_FreeSurface(dst);
  1.2623 -			}
  1.2624 -			if (dst_fmt->palette) {
  1.2625 -				SDL_FreePalette(dst_fmt->palette);
  1.2626 -			}
  1.2627 -			SDL_FreeFormat(dst_fmt);
  1.2628 -		}
  1.2629 -		if (!dst) {
  1.2630 -			SDL_DestroyTexture(textureID);
  1.2631 -			return 0;
  1.2632 -		}
  1.2633 -	}
  1.2634 +        /* Set up a destination surface for the texture update */
  1.2635 +        dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
  1.2636 +        if (dst_fmt) {
  1.2637 +            if (SDL_ISPIXELFORMAT_INDEXED(format)) {
  1.2638 +                dst_fmt->palette =
  1.2639 +                    SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
  1.2640 +                if (dst_fmt->palette) {
  1.2641 +                    /*
  1.2642 +                     * FIXME: Should we try to copy
  1.2643 +                     * fmt->palette?
  1.2644 +                     */
  1.2645 +                    SDL_DitherColors(dst_fmt->palette->colors,
  1.2646 +                                     SDL_BITSPERPIXEL(format));
  1.2647 +                }
  1.2648 +            }
  1.2649 +            dst = SDL_ConvertSurface(surface, dst_fmt, 0);
  1.2650 +            if (dst) {
  1.2651 +                SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
  1.2652 +                SDL_FreeSurface(dst);
  1.2653 +            }
  1.2654 +            if (dst_fmt->palette) {
  1.2655 +                SDL_FreePalette(dst_fmt->palette);
  1.2656 +            }
  1.2657 +            SDL_FreeFormat(dst_fmt);
  1.2658 +        }
  1.2659 +        if (!dst) {
  1.2660 +            SDL_DestroyTexture(textureID);
  1.2661 +            return 0;
  1.2662 +        }
  1.2663 +    }
  1.2664  
  1.2665 -	if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
  1.2666 -		SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
  1.2667 -				      fmt->palette->ncolors);
  1.2668 -	}
  1.2669 -	return textureID;
  1.2670 +    if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
  1.2671 +        SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
  1.2672 +                              fmt->palette->ncolors);
  1.2673 +    }
  1.2674 +    return textureID;
  1.2675  }
  1.2676  
  1.2677  static __inline__ SDL_Texture *
  1.2678  SDL_GetTextureFromID(SDL_TextureID textureID)
  1.2679  {
  1.2680 -	int             hash;
  1.2681 -	SDL_Texture    *texture;
  1.2682 +    int hash;
  1.2683 +    SDL_Texture *texture;
  1.2684  
  1.2685 -	if (!_this) {
  1.2686 -		return NULL;
  1.2687 -	}
  1.2688 -	hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
  1.2689 -	for (texture = SDL_CurrentDisplay.textures[hash]; texture;
  1.2690 -	     texture = texture->next) {
  1.2691 -		if (texture->id == textureID) {
  1.2692 -			return texture;
  1.2693 -		}
  1.2694 -	}
  1.2695 -	return NULL;
  1.2696 +    if (!_this) {
  1.2697 +        return NULL;
  1.2698 +    }
  1.2699 +    hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
  1.2700 +    for (texture = SDL_CurrentDisplay.textures[hash]; texture;
  1.2701 +         texture = texture->next) {
  1.2702 +        if (texture->id == textureID) {
  1.2703 +            return texture;
  1.2704 +        }
  1.2705 +    }
  1.2706 +    return NULL;
  1.2707  }
  1.2708  
  1.2709  int
  1.2710  SDL_QueryTexture(SDL_TextureID textureID, Uint32 * format, int *access,
  1.2711 -		 int *w, int *h)
  1.2712 +                 int *w, int *h)
  1.2713  {
  1.2714 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2715 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2716  
  1.2717 -	if (!texture) {
  1.2718 -		return -1;
  1.2719 -	}
  1.2720 -	if (format) {
  1.2721 -		*format = texture->format;
  1.2722 -	}
  1.2723 -	if (access) {
  1.2724 -		*access = texture->access;
  1.2725 -	}
  1.2726 -	if (w) {
  1.2727 -		*w = texture->w;
  1.2728 -	}
  1.2729 -	if (h) {
  1.2730 -		*h = texture->h;
  1.2731 -	}
  1.2732 -	return 0;
  1.2733 +    if (!texture) {
  1.2734 +        return -1;
  1.2735 +    }
  1.2736 +    if (format) {
  1.2737 +        *format = texture->format;
  1.2738 +    }
  1.2739 +    if (access) {
  1.2740 +        *access = texture->access;
  1.2741 +    }
  1.2742 +    if (w) {
  1.2743 +        *w = texture->w;
  1.2744 +    }
  1.2745 +    if (h) {
  1.2746 +        *h = texture->h;
  1.2747 +    }
  1.2748 +    return 0;
  1.2749  }
  1.2750  
  1.2751  int
  1.2752  SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int *pitch)
  1.2753  {
  1.2754 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2755 -	SDL_Renderer   *renderer;
  1.2756 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2757 +    SDL_Renderer *renderer;
  1.2758  
  1.2759 -	if (!texture) {
  1.2760 -		return -1;
  1.2761 -	}
  1.2762 -	renderer = texture->renderer;
  1.2763 -	if (!renderer->QueryTexturePixels) {
  1.2764 -		return -1;
  1.2765 -	}
  1.2766 -	return renderer->QueryTexturePixels(renderer, texture, pixels, pitch);
  1.2767 +    if (!texture) {
  1.2768 +        return -1;
  1.2769 +    }
  1.2770 +    renderer = texture->renderer;
  1.2771 +    if (!renderer->QueryTexturePixels) {
  1.2772 +        return -1;
  1.2773 +    }
  1.2774 +    return renderer->QueryTexturePixels(renderer, texture, pixels, pitch);
  1.2775  }
  1.2776  
  1.2777  int
  1.2778  SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors,
  1.2779 -		      int firstcolor, int ncolors)
  1.2780 +                      int firstcolor, int ncolors)
  1.2781  {
  1.2782 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2783 -	SDL_Renderer   *renderer;
  1.2784 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2785 +    SDL_Renderer *renderer;
  1.2786  
  1.2787 -	if (!texture) {
  1.2788 -		return -1;
  1.2789 -	}
  1.2790 -	renderer = texture->renderer;
  1.2791 -	if (!renderer->SetTexturePalette) {
  1.2792 -		return -1;
  1.2793 -	}
  1.2794 -	return renderer->SetTexturePalette(renderer, texture, colors, firstcolor,
  1.2795 -					   ncolors);
  1.2796 +    if (!texture) {
  1.2797 +        return -1;
  1.2798 +    }
  1.2799 +    renderer = texture->renderer;
  1.2800 +    if (!renderer->SetTexturePalette) {
  1.2801 +        return -1;
  1.2802 +    }
  1.2803 +    return renderer->SetTexturePalette(renderer, texture, colors, firstcolor,
  1.2804 +                                       ncolors);
  1.2805  }
  1.2806  
  1.2807  int
  1.2808  SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors,
  1.2809 -		      int firstcolor, int ncolors)
  1.2810 +                      int firstcolor, int ncolors)
  1.2811  {
  1.2812 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2813 -	SDL_Renderer   *renderer;
  1.2814 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2815 +    SDL_Renderer *renderer;
  1.2816  
  1.2817 -	if (!texture) {
  1.2818 -		return -1;
  1.2819 -	}
  1.2820 -	renderer = texture->renderer;
  1.2821 -	if (!renderer->GetTexturePalette) {
  1.2822 -		return -1;
  1.2823 -	}
  1.2824 -	return renderer->GetTexturePalette(renderer, texture, colors, firstcolor,
  1.2825 -					   ncolors);
  1.2826 +    if (!texture) {
  1.2827 +        return -1;
  1.2828 +    }
  1.2829 +    renderer = texture->renderer;
  1.2830 +    if (!renderer->GetTexturePalette) {
  1.2831 +        return -1;
  1.2832 +    }
  1.2833 +    return renderer->GetTexturePalette(renderer, texture, colors, firstcolor,
  1.2834 +                                       ncolors);
  1.2835  }
  1.2836  
  1.2837  int
  1.2838  SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
  1.2839  {
  1.2840 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2841 -	SDL_Renderer   *renderer;
  1.2842 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2843 +    SDL_Renderer *renderer;
  1.2844  
  1.2845 -	if (!texture) {
  1.2846 -		return -1;
  1.2847 -	}
  1.2848 -	renderer = texture->renderer;
  1.2849 -	if (!renderer->SetTextureColorMod) {
  1.2850 -		return -1;
  1.2851 -	}
  1.2852 -	if (r < 255 || g < 255 || b < 255) {
  1.2853 -		texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
  1.2854 -	} else {
  1.2855 -		texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR;
  1.2856 -	}
  1.2857 -	texture->r = r;
  1.2858 -	texture->g = g;
  1.2859 -	texture->b = b;
  1.2860 -	return renderer->SetTextureColorMod(renderer, texture);
  1.2861 +    if (!texture) {
  1.2862 +        return -1;
  1.2863 +    }
  1.2864 +    renderer = texture->renderer;
  1.2865 +    if (!renderer->SetTextureColorMod) {
  1.2866 +        return -1;
  1.2867 +    }
  1.2868 +    if (r < 255 || g < 255 || b < 255) {
  1.2869 +        texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
  1.2870 +    } else {
  1.2871 +        texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR;
  1.2872 +    }
  1.2873 +    texture->r = r;
  1.2874 +    texture->g = g;
  1.2875 +    texture->b = b;
  1.2876 +    return renderer->SetTextureColorMod(renderer, texture);
  1.2877  }
  1.2878  
  1.2879  int
  1.2880  SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 * r, Uint8 * g,
  1.2881 -		       Uint8 * b)
  1.2882 +                       Uint8 * b)
  1.2883  {
  1.2884 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2885 -	SDL_Renderer   *renderer;
  1.2886 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2887 +    SDL_Renderer *renderer;
  1.2888  
  1.2889 -	if (!texture) {
  1.2890 -		return -1;
  1.2891 -	}
  1.2892 -	renderer = texture->renderer;
  1.2893 -	if (r) {
  1.2894 -		*r = texture->r;
  1.2895 -	}
  1.2896 -	if (g) {
  1.2897 -		*g = texture->g;
  1.2898 -	}
  1.2899 -	if (b) {
  1.2900 -		*b = texture->b;
  1.2901 -	}
  1.2902 -	return 0;
  1.2903 +    if (!texture) {
  1.2904 +        return -1;
  1.2905 +    }
  1.2906 +    renderer = texture->renderer;
  1.2907 +    if (r) {
  1.2908 +        *r = texture->r;
  1.2909 +    }
  1.2910 +    if (g) {
  1.2911 +        *g = texture->g;
  1.2912 +    }
  1.2913 +    if (b) {
  1.2914 +        *b = texture->b;
  1.2915 +    }
  1.2916 +    return 0;
  1.2917  }
  1.2918  
  1.2919  int
  1.2920  SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
  1.2921  {
  1.2922 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2923 -	SDL_Renderer   *renderer;
  1.2924 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2925 +    SDL_Renderer *renderer;
  1.2926  
  1.2927 -	if (!texture) {
  1.2928 -		return -1;
  1.2929 -	}
  1.2930 -	renderer = texture->renderer;
  1.2931 -	if (!renderer->SetTextureAlphaMod) {
  1.2932 -		return -1;
  1.2933 -	}
  1.2934 -	if (alpha < 255) {
  1.2935 -		texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
  1.2936 -	} else {
  1.2937 -		texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
  1.2938 -	}
  1.2939 -	texture->a = alpha;
  1.2940 -	return renderer->SetTextureAlphaMod(renderer, texture);
  1.2941 +    if (!texture) {
  1.2942 +        return -1;
  1.2943 +    }
  1.2944 +    renderer = texture->renderer;
  1.2945 +    if (!renderer->SetTextureAlphaMod) {
  1.2946 +        return -1;
  1.2947 +    }
  1.2948 +    if (alpha < 255) {
  1.2949 +        texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
  1.2950 +    } else {
  1.2951 +        texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
  1.2952 +    }
  1.2953 +    texture->a = alpha;
  1.2954 +    return renderer->SetTextureAlphaMod(renderer, texture);
  1.2955  }
  1.2956  
  1.2957  int
  1.2958  SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 * alpha)
  1.2959  {
  1.2960 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2961 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2962  
  1.2963 -	if (!texture) {
  1.2964 -		return -1;
  1.2965 -	}
  1.2966 -	if (alpha) {
  1.2967 -		*alpha = texture->a;
  1.2968 -	}
  1.2969 -	return 0;
  1.2970 +    if (!texture) {
  1.2971 +        return -1;
  1.2972 +    }
  1.2973 +    if (alpha) {
  1.2974 +        *alpha = texture->a;
  1.2975 +    }
  1.2976 +    return 0;
  1.2977  }
  1.2978  
  1.2979  int
  1.2980  SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
  1.2981  {
  1.2982 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.2983 -	SDL_Renderer   *renderer;
  1.2984 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.2985 +    SDL_Renderer *renderer;
  1.2986  
  1.2987 -	if (!texture) {
  1.2988 -		return -1;
  1.2989 -	}
  1.2990 -	renderer = texture->renderer;
  1.2991 -	if (!renderer->SetTextureBlendMode) {
  1.2992 -		return -1;
  1.2993 -	}
  1.2994 -	texture->blendMode = blendMode;
  1.2995 -	return renderer->SetTextureBlendMode(renderer, texture);
  1.2996 +    if (!texture) {
  1.2997 +        return -1;
  1.2998 +    }
  1.2999 +    renderer = texture->renderer;
  1.3000 +    if (!renderer->SetTextureBlendMode) {
  1.3001 +        return -1;
  1.3002 +    }
  1.3003 +    texture->blendMode = blendMode;
  1.3004 +    return renderer->SetTextureBlendMode(renderer, texture);
  1.3005  }
  1.3006  
  1.3007  int
  1.3008  SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode)
  1.3009  {
  1.3010 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3011 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3012  
  1.3013 -	if (!texture) {
  1.3014 -		return -1;
  1.3015 -	}
  1.3016 -	if (blendMode) {
  1.3017 -		*blendMode = texture->blendMode;
  1.3018 -	}
  1.3019 -	return 0;
  1.3020 +    if (!texture) {
  1.3021 +        return -1;
  1.3022 +    }
  1.3023 +    if (blendMode) {
  1.3024 +        *blendMode = texture->blendMode;
  1.3025 +    }
  1.3026 +    return 0;
  1.3027  }
  1.3028  
  1.3029  int
  1.3030  SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
  1.3031  {
  1.3032 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3033 -	SDL_Renderer   *renderer;
  1.3034 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3035 +    SDL_Renderer *renderer;
  1.3036  
  1.3037 -	if (!texture) {
  1.3038 -		return -1;
  1.3039 -	}
  1.3040 -	renderer = texture->renderer;
  1.3041 -	if (!renderer->SetTextureScaleMode) {
  1.3042 -		return -1;
  1.3043 -	}
  1.3044 -	texture->scaleMode = scaleMode;
  1.3045 -	return renderer->SetTextureScaleMode(renderer, texture);
  1.3046 +    if (!texture) {
  1.3047 +        return -1;
  1.3048 +    }
  1.3049 +    renderer = texture->renderer;
  1.3050 +    if (!renderer->SetTextureScaleMode) {
  1.3051 +        return -1;
  1.3052 +    }
  1.3053 +    texture->scaleMode = scaleMode;
  1.3054 +    return renderer->SetTextureScaleMode(renderer, texture);
  1.3055  }
  1.3056  
  1.3057  int
  1.3058  SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode)
  1.3059  {
  1.3060 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3061 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3062  
  1.3063 -	if (!texture) {
  1.3064 -		return -1;
  1.3065 -	}
  1.3066 -	if (scaleMode) {
  1.3067 -		*scaleMode = texture->scaleMode;
  1.3068 -	}
  1.3069 -	return 0;
  1.3070 +    if (!texture) {
  1.3071 +        return -1;
  1.3072 +    }
  1.3073 +    if (scaleMode) {
  1.3074 +        *scaleMode = texture->scaleMode;
  1.3075 +    }
  1.3076 +    return 0;
  1.3077  }
  1.3078  
  1.3079  int
  1.3080  SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect,
  1.3081 -		  const void *pixels, int pitch)
  1.3082 +                  const void *pixels, int pitch)
  1.3083  {
  1.3084 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3085 -	SDL_Renderer   *renderer;
  1.3086 -	SDL_Rect        full_rect;
  1.3087 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3088 +    SDL_Renderer *renderer;
  1.3089 +    SDL_Rect full_rect;
  1.3090  
  1.3091 -	if (!texture) {
  1.3092 -		return -1;
  1.3093 -	}
  1.3094 -	renderer = texture->renderer;
  1.3095 -	if (!renderer->UpdateTexture) {
  1.3096 -		return -1;
  1.3097 -	}
  1.3098 -	if (!rect) {
  1.3099 -		full_rect.x = 0;
  1.3100 -		full_rect.y = 0;
  1.3101 -		full_rect.w = texture->w;
  1.3102 -		full_rect.h = texture->h;
  1.3103 -		rect = &full_rect;
  1.3104 -	}
  1.3105 -	return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
  1.3106 +    if (!texture) {
  1.3107 +        return -1;
  1.3108 +    }
  1.3109 +    renderer = texture->renderer;
  1.3110 +    if (!renderer->UpdateTexture) {
  1.3111 +        return -1;
  1.3112 +    }
  1.3113 +    if (!rect) {
  1.3114 +        full_rect.x = 0;
  1.3115 +        full_rect.y = 0;
  1.3116 +        full_rect.w = texture->w;
  1.3117 +        full_rect.h = texture->h;
  1.3118 +        rect = &full_rect;
  1.3119 +    }
  1.3120 +    return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
  1.3121  }
  1.3122  
  1.3123  int
  1.3124  SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty,
  1.3125 -		void **pixels, int *pitch)
  1.3126 +                void **pixels, int *pitch)
  1.3127  {
  1.3128 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3129 -	SDL_Renderer   *renderer;
  1.3130 -	SDL_Rect        full_rect;
  1.3131 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3132 +    SDL_Renderer *renderer;
  1.3133 +    SDL_Rect full_rect;
  1.3134  
  1.3135 -	if (!texture) {
  1.3136 -		return -1;
  1.3137 -	}
  1.3138 -	if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
  1.3139 -		SDL_SetError("SDL_LockTexture(): texture must be streaming");
  1.3140 -		return -1;
  1.3141 -	}
  1.3142 -	renderer = texture->renderer;
  1.3143 -	if (!renderer->LockTexture) {
  1.3144 -		return -1;
  1.3145 -	}
  1.3146 -	if (!rect) {
  1.3147 -		full_rect.x = 0;
  1.3148 -		full_rect.y = 0;
  1.3149 -		full_rect.w = texture->w;
  1.3150 -		full_rect.h = texture->h;
  1.3151 -		rect = &full_rect;
  1.3152 -	}
  1.3153 -	return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
  1.3154 -				     pitch);
  1.3155 +    if (!texture) {
  1.3156 +        return -1;
  1.3157 +    }
  1.3158 +    if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
  1.3159 +        SDL_SetError("SDL_LockTexture(): texture must be streaming");
  1.3160 +        return -1;
  1.3161 +    }
  1.3162 +    renderer = texture->renderer;
  1.3163 +    if (!renderer->LockTexture) {
  1.3164 +        return -1;
  1.3165 +    }
  1.3166 +    if (!rect) {
  1.3167 +        full_rect.x = 0;
  1.3168 +        full_rect.y = 0;
  1.3169 +        full_rect.w = texture->w;
  1.3170 +        full_rect.h = texture->h;
  1.3171 +        rect = &full_rect;
  1.3172 +    }
  1.3173 +    return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
  1.3174 +                                 pitch);
  1.3175  }
  1.3176  
  1.3177  void
  1.3178  SDL_UnlockTexture(SDL_TextureID textureID)
  1.3179  {
  1.3180 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3181 -	SDL_Renderer   *renderer;
  1.3182 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3183 +    SDL_Renderer *renderer;
  1.3184  
  1.3185 -	if (!texture) {
  1.3186 -		return;
  1.3187 -	}
  1.3188 -	if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
  1.3189 -		return;
  1.3190 -	}
  1.3191 -	renderer = texture->renderer;
  1.3192 -	if (!renderer->UnlockTexture) {
  1.3193 -		return;
  1.3194 -	}
  1.3195 -	renderer->UnlockTexture(renderer, texture);
  1.3196 +    if (!texture) {
  1.3197 +        return;
  1.3198 +    }
  1.3199 +    if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
  1.3200 +        return;
  1.3201 +    }
  1.3202 +    renderer = texture->renderer;
  1.3203 +    if (!renderer->UnlockTexture) {
  1.3204 +        return;
  1.3205 +    }
  1.3206 +    renderer->UnlockTexture(renderer, texture);
  1.3207  }
  1.3208  
  1.3209  void
  1.3210  SDL_DirtyTexture(SDL_TextureID textureID, int numrects,
  1.3211 -		 const SDL_Rect * rects)
  1.3212 +                 const SDL_Rect * rects)
  1.3213  {
  1.3214 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3215 -	SDL_Renderer   *renderer;
  1.3216 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3217 +    SDL_Renderer *renderer;
  1.3218  
  1.3219 -	if (!texture) {
  1.3220 -		return;
  1.3221 -	}
  1.3222 -	if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
  1.3223 -		return;
  1.3224 -	}
  1.3225 -	renderer = texture->renderer;
  1.3226 -	if (!renderer->DirtyTexture) {
  1.3227 -		return;
  1.3228 -	}
  1.3229 -	renderer->DirtyTexture(renderer, texture, numrects, rects);
  1.3230 +    if (!texture) {
  1.3231 +        return;
  1.3232 +    }
  1.3233 +    if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
  1.3234 +        return;
  1.3235 +    }
  1.3236 +    renderer = texture->renderer;
  1.3237 +    if (!renderer->DirtyTexture) {
  1.3238 +        return;
  1.3239 +    }
  1.3240 +    renderer->DirtyTexture(renderer, texture, numrects, rects);
  1.3241  }
  1.3242  
  1.3243  int
  1.3244  SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
  1.3245  {
  1.3246 -	SDL_Renderer   *renderer;
  1.3247 -	SDL_Window     *window;
  1.3248 -	SDL_Rect        real_rect;
  1.3249 +    SDL_Renderer *renderer;
  1.3250 +    SDL_Window *window;
  1.3251 +    SDL_Rect real_rect;
  1.3252  
  1.3253 -	if (!_this) {
  1.3254 -		SDL_UninitializedVideo();
  1.3255 -		return -1;
  1.3256 -	}
  1.3257 -	renderer = SDL_CurrentDisplay.current_renderer;
  1.3258 -	if (!renderer || !renderer->RenderFill) {
  1.3259 -		return -1;
  1.3260 -	}
  1.3261 -	window = SDL_GetWindowFromID(renderer->window);
  1.3262 -	real_rect.x = 0;
  1.3263 -	real_rect.y = 0;
  1.3264 -	real_rect.w = window->w;
  1.3265 -	real_rect.h = window->h;
  1.3266 -	if (rect) {
  1.3267 -		if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
  1.3268 -			return 0;
  1.3269 -		}
  1.3270 -	}
  1.3271 -	return renderer->RenderFill(renderer, r, g, b, a, &real_rect);
  1.3272 +    if (!_this) {
  1.3273 +        SDL_UninitializedVideo();
  1.3274 +        return -1;
  1.3275 +    }
  1.3276 +    renderer = SDL_CurrentDisplay.current_renderer;
  1.3277 +    if (!renderer || !renderer->RenderFill) {
  1.3278 +        return -1;
  1.3279 +    }
  1.3280 +    window = SDL_GetWindowFromID(renderer->window);
  1.3281 +    real_rect.x = 0;
  1.3282 +    real_rect.y = 0;
  1.3283 +    real_rect.w = window->w;
  1.3284 +    real_rect.h = window->h;
  1.3285 +    if (rect) {
  1.3286 +        if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
  1.3287 +            return 0;
  1.3288 +        }
  1.3289 +    }
  1.3290 +    return renderer->RenderFill(renderer, r, g, b, a, &real_rect);
  1.3291  }
  1.3292  
  1.3293  int
  1.3294  SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect,
  1.3295 -	       const SDL_Rect * dstrect)
  1.3296 +               const SDL_Rect * dstrect)
  1.3297  {
  1.3298 -	SDL_Texture    *texture = SDL_GetTextureFromID(textureID);
  1.3299 -	SDL_Renderer   *renderer;
  1.3300 -	SDL_Window     *window;
  1.3301 -	SDL_Rect        real_srcrect;
  1.3302 -	SDL_Rect        real_dstrect;
  1.3303 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
  1.3304 +    SDL_Renderer *renderer;
  1.3305 +    SDL_Window *window;
  1.3306 +    SDL_Rect real_srcrect;
  1.3307 +    SDL_Rect real_dstrect;
  1.3308  
  1.3309 -	if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
  1.3310 -		return -1;
  1.3311 -	}
  1.3312 -	renderer = SDL_CurrentDisplay.current_renderer;
  1.3313 -	if (!renderer || !renderer->RenderCopy) {
  1.3314 -		return -1;
  1.3315 -	}
  1.3316 -	window = SDL_GetWindowFromID(renderer->window);
  1.3317 -	if (srcrect) {
  1.3318 -		real_srcrect = *srcrect;
  1.3319 -	} else {
  1.3320 -		real_srcrect.x = 0;
  1.3321 -		real_srcrect.y = 0;
  1.3322 -		real_srcrect.w = texture->w;
  1.3323 -		real_srcrect.h = texture->h;
  1.3324 -	}
  1.3325 -	if (dstrect) {
  1.3326 -		real_dstrect = *dstrect;
  1.3327 -	} else {
  1.3328 -		real_dstrect.x = 0;
  1.3329 -		real_dstrect.y = 0;
  1.3330 -		real_dstrect.w = window->w;
  1.3331 -		real_dstrect.h = window->h;
  1.3332 -	}
  1.3333 +    if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
  1.3334 +        return -1;
  1.3335 +    }
  1.3336 +    renderer = SDL_CurrentDisplay.current_renderer;
  1.3337 +    if (!renderer || !renderer->RenderCopy) {
  1.3338 +        return -1;
  1.3339 +    }
  1.3340 +    window = SDL_GetWindowFromID(renderer->window);
  1.3341 +    if (srcrect) {
  1.3342 +        real_srcrect = *srcrect;
  1.3343 +    } else {
  1.3344 +        real_srcrect.x = 0;
  1.3345 +        real_srcrect.y = 0;
  1.3346 +        real_srcrect.w = texture->w;
  1.3347 +        real_srcrect.h = texture->h;
  1.3348 +    }
  1.3349 +    if (dstrect) {
  1.3350 +        real_dstrect = *dstrect;
  1.3351 +    } else {
  1.3352 +        real_dstrect.x = 0;
  1.3353 +        real_dstrect.y = 0;
  1.3354 +        real_dstrect.w = window->w;
  1.3355 +        real_dstrect.h = window->h;
  1.3356 +    }
  1.3357  
  1.3358 -	return renderer->RenderCopy(renderer, texture, &real_srcrect,
  1.3359 -				    &real_dstrect);
  1.3360 +    return renderer->RenderCopy(renderer, texture, &real_srcrect,
  1.3361 +                                &real_dstrect);
  1.3362  }
  1.3363  
  1.3364  void
  1.3365  SDL_RenderPresent(void)
  1.3366  {
  1.3367 -	SDL_Renderer   *renderer;
  1.3368 +    SDL_Renderer *renderer;
  1.3369  
  1.3370 -	if (!_this) {
  1.3371 -		SDL_UninitializedVideo();
  1.3372 -		return;
  1.3373 -	}
  1.3374 -	renderer = SDL_CurrentDisplay.current_renderer;
  1.3375 -	if (!renderer || !renderer->RenderPresent) {
  1.3376 -		return;
  1.3377 -	}
  1.3378 -	renderer->RenderPresent(renderer);
  1.3379 +    if (!_this) {
  1.3380 +        SDL_UninitializedVideo();
  1.3381 +        return;
  1.3382 +    }
  1.3383 +    renderer = SDL_CurrentDisplay.current_renderer;
  1.3384 +    if (!renderer || !renderer->RenderPresent) {
  1.3385 +        return;
  1.3386 +    }
  1.3387 +    renderer->RenderPresent(renderer);
  1.3388  }
  1.3389  
  1.3390  void
  1.3391  SDL_DestroyTexture(SDL_TextureID textureID)
  1.3392  {
  1.3393 -	int             hash;
  1.3394 -	SDL_Texture    *prev, *texture;
  1.3395 -	SDL_Renderer   *renderer;
  1.3396 +    int hash;
  1.3397 +    SDL_Texture *prev, *texture;
  1.3398 +    SDL_Renderer *renderer;
  1.3399  
  1.3400 -	if (!_this) {
  1.3401 -		SDL_UninitializedVideo();
  1.3402 -		return;
  1.3403 -	}
  1.3404 -	/* Look up the texture in the hash table */
  1.3405 -	hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
  1.3406 -	prev = NULL;
  1.3407 -	for (texture = SDL_CurrentDisplay.textures[hash]; texture;
  1.3408 -	     prev = texture, texture = texture->next) {
  1.3409 -		if (texture->id == textureID) {
  1.3410 -			break;
  1.3411 -		}
  1.3412 -	}
  1.3413 -	if (!texture) {
  1.3414 -		return;
  1.3415 -	}
  1.3416 -	/* Unlink the texture from the list */
  1.3417 -	if (prev) {
  1.3418 -		prev->next = texture->next;
  1.3419 -	} else {
  1.3420 -		SDL_CurrentDisplay.textures[hash] = texture->next;
  1.3421 -	}
  1.3422 +    if (!_this) {
  1.3423 +        SDL_UninitializedVideo();
  1.3424 +        return;
  1.3425 +    }
  1.3426 +    /* Look up the texture in the hash table */
  1.3427 +    hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
  1.3428 +    prev = NULL;
  1.3429 +    for (texture = SDL_CurrentDisplay.textures[hash]; texture;
  1.3430 +         prev = texture, texture = texture->next) {
  1.3431 +        if (texture->id == textureID) {
  1.3432 +            break;
  1.3433 +        }
  1.3434 +    }
  1.3435 +    if (!texture) {
  1.3436 +        return;
  1.3437 +    }
  1.3438 +    /* Unlink the texture from the list */
  1.3439 +    if (prev) {
  1.3440 +        prev->next = texture->next;
  1.3441 +    } else {
  1.3442 +        SDL_CurrentDisplay.textures[hash] = texture->next;
  1.3443 +    }
  1.3444  
  1.3445 -	/* Free the texture */
  1.3446 -	renderer = texture->renderer;
  1.3447 -	renderer->DestroyTexture(renderer, texture);
  1.3448 -	SDL_free(texture);
  1.3449 +    /* Free the texture */
  1.3450 +    renderer = texture->renderer;
  1.3451 +    renderer->DestroyTexture(renderer, texture);
  1.3452 +    SDL_free(texture);
  1.3453  }
  1.3454  
  1.3455  void
  1.3456  SDL_DestroyRenderer(SDL_WindowID windowID)
  1.3457  {
  1.3458 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.3459 -	SDL_Renderer   *renderer;
  1.3460 -	int             i;
  1.3461 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.3462 +    SDL_Renderer *renderer;
  1.3463 +    int i;
  1.3464  
  1.3465 -	if (!window) {
  1.3466 -		return;
  1.3467 -	}
  1.3468 -	renderer = window->renderer;
  1.3469 -	if (!renderer) {
  1.3470 -		return;
  1.3471 -	}
  1.3472 -	/* Free existing textures for this renderer */
  1.3473 -	for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) {
  1.3474 -		SDL_Texture    *texture;
  1.3475 -		SDL_Texture    *prev = NULL;
  1.3476 -		SDL_Texture    *next;
  1.3477 -		for (texture = SDL_CurrentDisplay.textures[i]; texture;
  1.3478 -		     texture = next) {
  1.3479 -			next = texture->next;
  1.3480 -			if (texture->renderer == renderer) {
  1.3481 -				if (prev) {
  1.3482 -					prev->next = next;
  1.3483 -				} else {
  1.3484 -					SDL_CurrentDisplay.textures[i] = next;
  1.3485 -				}
  1.3486 -				renderer->DestroyTexture(renderer, texture);
  1.3487 -				SDL_free(texture);
  1.3488 -			} else {
  1.3489 -				prev = texture;
  1.3490 -			}
  1.3491 -		}
  1.3492 -	}
  1.3493 +    if (!window) {
  1.3494 +        return;
  1.3495 +    }
  1.3496 +    renderer = window->renderer;
  1.3497 +    if (!renderer) {
  1.3498 +        return;
  1.3499 +    }
  1.3500 +    /* Free existing textures for this renderer */
  1.3501 +    for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) {
  1.3502 +        SDL_Texture *texture;
  1.3503 +        SDL_Texture *prev = NULL;
  1.3504 +        SDL_Texture *next;
  1.3505 +        for (texture = SDL_CurrentDisplay.textures[i]; texture;
  1.3506 +             texture = next) {
  1.3507 +            next = texture->next;
  1.3508 +            if (texture->renderer == renderer) {
  1.3509 +                if (prev) {
  1.3510 +                    prev->next = next;
  1.3511 +                } else {
  1.3512 +                    SDL_CurrentDisplay.textures[i] = next;
  1.3513 +                }
  1.3514 +                renderer->DestroyTexture(renderer, texture);
  1.3515 +                SDL_free(texture);
  1.3516 +            } else {
  1.3517 +                prev = texture;
  1.3518 +            }
  1.3519 +        }
  1.3520 +    }
  1.3521  
  1.3522 -	/* Free the renderer instance */
  1.3523 -	renderer->DestroyRenderer(renderer);
  1.3524 +    /* Free the renderer instance */
  1.3525 +    renderer->DestroyRenderer(renderer);
  1.3526  
  1.3527 -	/* Clear references */
  1.3528 -	window->renderer = NULL;
  1.3529 -	if (SDL_CurrentDisplay.current_renderer == renderer) {
  1.3530 -		SDL_CurrentDisplay.current_renderer = NULL;
  1.3531 -	}
  1.3532 +    /* Clear references */
  1.3533 +    window->renderer = NULL;
  1.3534 +    if (SDL_CurrentDisplay.current_renderer == renderer) {
  1.3535 +        SDL_CurrentDisplay.current_renderer = NULL;
  1.3536 +    }
  1.3537  }
  1.3538  
  1.3539  void
  1.3540  SDL_VideoQuit(void)
  1.3541  {
  1.3542 -	int             i, j;
  1.3543 +    int i, j;
  1.3544  
  1.3545 -	if (!_this) {
  1.3546 -		return;
  1.3547 -	}
  1.3548 -	/* Halt event processing before doing anything else */
  1.3549 -	SDL_StopEventLoop();
  1.3550 +    if (!_this) {
  1.3551 +        return;
  1.3552 +    }
  1.3553 +    /* Halt event processing before doing anything else */
  1.3554 +    SDL_StopEventLoop();
  1.3555  
  1.3556 -	/* Clean up the system video */
  1.3557 -	for (i = _this->num_displays; i--;) {
  1.3558 -		SDL_VideoDisplay *display = &_this->displays[i];
  1.3559 -		for (j = display->num_windows; j--;) {
  1.3560 -			SDL_DestroyWindow(display->windows[i].id);
  1.3561 -		}
  1.3562 -		if (display->windows) {
  1.3563 -			SDL_free(display->windows);
  1.3564 -			display->windows = NULL;
  1.3565 -		}
  1.3566 -		display->num_windows = 0;
  1.3567 -		if (display->render_drivers) {
  1.3568 -			SDL_free(display->render_drivers);
  1.3569 -			display->render_drivers = NULL;
  1.3570 -		}
  1.3571 -		display->num_render_drivers = 0;
  1.3572 -	}
  1.3573 -	_this->VideoQuit(_this);
  1.3574 +    /* Clean up the system video */
  1.3575 +    for (i = _this->num_displays; i--;) {
  1.3576 +        SDL_VideoDisplay *display = &_this->displays[i];
  1.3577 +        for (j = display->num_windows; j--;) {
  1.3578 +            SDL_DestroyWindow(display->windows[i].id);
  1.3579 +        }
  1.3580 +        if (display->windows) {
  1.3581 +            SDL_free(display->windows);
  1.3582 +            display->windows = NULL;
  1.3583 +        }
  1.3584 +        display->num_windows = 0;
  1.3585 +        if (display->render_drivers) {
  1.3586 +            SDL_free(display->render_drivers);
  1.3587 +            display->render_drivers = NULL;
  1.3588 +        }
  1.3589 +        display->num_render_drivers = 0;
  1.3590 +    }
  1.3591 +    _this->VideoQuit(_this);
  1.3592  
  1.3593 -	for (i = _this->num_displays; i--;) {
  1.3594 -		SDL_VideoDisplay *display = &_this->displays[i];
  1.3595 -		for (j = display->num_display_modes; j--;) {
  1.3596 -			if (display->display_modes[j].driverdata) {
  1.3597 -				SDL_free(display->display_modes[j].driverdata);
  1.3598 -				display->display_modes[j].driverdata = NULL;
  1.3599 -			}
  1.3600 -		}
  1.3601 -		if (display->display_modes) {
  1.3602 -			SDL_free(display->display_modes);
  1.3603 -			display->display_modes = NULL;
  1.3604 -		}
  1.3605 -		if (display->desktop_mode.driverdata) {
  1.3606 -			SDL_free(display->desktop_mode.driverdata);
  1.3607 -			display->desktop_mode.driverdata = NULL;
  1.3608 -		}
  1.3609 -		if (display->palette) {
  1.3610 -			SDL_FreePalette(display->palette);
  1.3611 -			display->palette = NULL;
  1.3612 -		}
  1.3613 -		if (display->gamma) {
  1.3614 -			SDL_free(display->gamma);
  1.3615 -			display->gamma = NULL;
  1.3616 -		}
  1.3617 -		if (display->driverdata) {
  1.3618 -			SDL_free(display->driverdata);
  1.3619 -			display->driverdata = NULL;
  1.3620 -		}
  1.3621 -	}
  1.3622 -	if (_this->displays) {
  1.3623 -		SDL_free(_this->displays);
  1.3624 -		_this->displays = NULL;
  1.3625 -	}
  1.3626 -	_this->free(_this);
  1.3627 -	_this = NULL;
  1.3628 +    for (i = _this->num_displays; i--;) {
  1.3629 +        SDL_VideoDisplay *display = &_this->displays[i];
  1.3630 +        for (j = display->num_display_modes; j--;) {
  1.3631 +            if (display->display_modes[j].driverdata) {
  1.3632 +                SDL_free(display->display_modes[j].driverdata);
  1.3633 +                display->display_modes[j].driverdata = NULL;
  1.3634 +            }
  1.3635 +        }
  1.3636 +        if (display->display_modes) {
  1.3637 +            SDL_free(display->display_modes);
  1.3638 +            display->display_modes = NULL;
  1.3639 +        }
  1.3640 +        if (display->desktop_mode.driverdata) {
  1.3641 +            SDL_free(display->desktop_mode.driverdata);
  1.3642 +            display->desktop_mode.driverdata = NULL;
  1.3643 +        }
  1.3644 +        if (display->palette) {
  1.3645 +            SDL_FreePalette(display->palette);
  1.3646 +            display->palette = NULL;
  1.3647 +        }
  1.3648 +        if (display->gamma) {
  1.3649 +            SDL_free(display->gamma);
  1.3650 +            display->gamma = NULL;
  1.3651 +        }
  1.3652 +        if (display->driverdata) {
  1.3653 +            SDL_free(display->driverdata);
  1.3654 +            display->driverdata = NULL;
  1.3655 +        }
  1.3656 +    }
  1.3657 +    if (_this->displays) {
  1.3658 +        SDL_free(_this->displays);
  1.3659 +        _this->displays = NULL;
  1.3660 +    }
  1.3661 +    _this->free(_this);
  1.3662 +    _this = NULL;
  1.3663  }
  1.3664  
  1.3665  int
  1.3666  SDL_GL_LoadLibrary(const char *path)
  1.3667  {
  1.3668 -	int             retval;
  1.3669 +    int retval;
  1.3670  
  1.3671 -	if (!_this) {
  1.3672 -		SDL_UninitializedVideo();
  1.3673 -		return -1;
  1.3674 -	}
  1.3675 -	if (_this->GL_LoadLibrary) {
  1.3676 -		retval = _this->GL_LoadLibrary(_this, path);
  1.3677 -	} else {
  1.3678 -		SDL_SetError("No dynamic GL support in video driver");
  1.3679 -		retval = -1;
  1.3680 -	}
  1.3681 -	return (retval);
  1.3682 +    if (!_this) {
  1.3683 +        SDL_UninitializedVideo();
  1.3684 +        return -1;
  1.3685 +    }
  1.3686 +    if (_this->GL_LoadLibrary) {
  1.3687 +        retval = _this->GL_LoadLibrary(_this, path);
  1.3688 +    } else {
  1.3689 +        SDL_SetError("No dynamic GL support in video driver");
  1.3690 +        retval = -1;
  1.3691 +    }
  1.3692 +    return (retval);
  1.3693  }
  1.3694  
  1.3695 -void           *
  1.3696 +void *
  1.3697  SDL_GL_GetProcAddress(const char *proc)
  1.3698  {
  1.3699 -	void           *func;
  1.3700 +    void *func;
  1.3701  
  1.3702 -	if (!_this) {
  1.3703 -		SDL_UninitializedVideo();
  1.3704 -		return NULL;
  1.3705 -	}
  1.3706 -	func = NULL;
  1.3707 -	if (_this->GL_GetProcAddress) {
  1.3708 -		if (_this->gl_config.driver_loaded) {
  1.3709 -			func = _this->GL_GetProcAddress(_this, proc);
  1.3710 -		} else {
  1.3711 -			SDL_SetError("No GL driver has been loaded");
  1.3712 -		}
  1.3713 -	} else {
  1.3714 -		SDL_SetError("No dynamic GL support in video driver");
  1.3715 -	}
  1.3716 -	return func;
  1.3717 +    if (!_this) {
  1.3718 +        SDL_UninitializedVideo();
  1.3719 +        return NULL;
  1.3720 +    }
  1.3721 +    func = NULL;
  1.3722 +    if (_this->GL_GetProcAddress) {
  1.3723 +        if (_this->gl_config.driver_loaded) {
  1.3724 +            func = _this->GL_GetProcAddress(_this, proc);
  1.3725 +        } else {
  1.3726 +            SDL_SetError("No GL driver has been loaded");
  1.3727 +        }
  1.3728 +    } else {
  1.3729 +        SDL_SetError("No dynamic GL support in video driver");
  1.3730 +    }
  1.3731 +    return func;
  1.3732  }
  1.3733  
  1.3734  SDL_bool
  1.3735  SDL_GL_ExtensionSupported(const char *extension)
  1.3736  {
  1.3737  #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
  1.3738 -	const GLubyte  *(APIENTRY * glGetStringFunc) (GLenum);
  1.3739 -	const char     *extensions;
  1.3740 -	const char     *start;
  1.3741 -	const char     *where, *terminator;
  1.3742 +    const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
  1.3743 +    const char *extensions;
  1.3744 +    const char *start;
  1.3745 +    const char *where, *terminator;
  1.3746  
  1.3747 -	/* Extension names should not have spaces. */
  1.3748 -	where = SDL_strchr(extension, ' ');
  1.3749 -	if (where || *extension == '\0') {
  1.3750 -		return SDL_FALSE;
  1.3751 -	}
  1.3752 -	/* See if there's an environment variable override */
  1.3753 -	start = SDL_getenv(extension);
  1.3754 -	if (start && *start == '0') {
  1.3755 -		return SDL_FALSE;
  1.3756 -	}
  1.3757 -	/* Lookup the available extensions */
  1.3758 -	glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
  1.3759 -	if (glGetStringFunc) {
  1.3760 -		extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
  1.3761 -	} else {
  1.3762 -		extensions = NULL;
  1.3763 -	}
  1.3764 -	if (!extensions) {
  1.3765 -		return SDL_FALSE;
  1.3766 -	}
  1.3767 -	/*
  1.3768 -	 * It takes a bit of care to be fool-proof about parsing the OpenGL
  1.3769 -	 * extensions string. Don't be fooled by sub-strings, etc.
  1.3770 -	 */
  1.3771 +    /* Extension names should not have spaces. */
  1.3772 +    where = SDL_strchr(extension, ' ');
  1.3773 +    if (where || *extension == '\0') {
  1.3774 +        return SDL_FALSE;
  1.3775 +    }
  1.3776 +    /* See if there's an environment variable override */
  1.3777 +    start = SDL_getenv(extension);
  1.3778 +    if (start && *start == '0') {
  1.3779 +        return SDL_FALSE;
  1.3780 +    }
  1.3781 +    /* Lookup the available extensions */
  1.3782 +    glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
  1.3783 +    if (glGetStringFunc) {
  1.3784 +        extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
  1.3785 +    } else {
  1.3786 +        extensions = NULL;
  1.3787 +    }
  1.3788 +    if (!extensions) {
  1.3789 +        return SDL_FALSE;
  1.3790 +    }
  1.3791 +    /*
  1.3792 +     * It takes a bit of care to be fool-proof about parsing the OpenGL
  1.3793 +     * extensions string. Don't be fooled by sub-strings, etc.
  1.3794 +     */
  1.3795  
  1.3796 -	start = extensions;
  1.3797 +    start = extensions;
  1.3798  
  1.3799 -	for (;;) {
  1.3800 -		where = SDL_strstr(start, extension);
  1.3801 -		if (!where)
  1.3802 -			break;
  1.3803 +    for (;;) {
  1.3804 +        where = SDL_strstr(start, extension);
  1.3805 +        if (!where)
  1.3806 +            break;
  1.3807  
  1.3808 -		terminator = where + SDL_strlen(extension);
  1.3809 -		if (where == start || *(where - 1) == ' ')
  1.3810 -			if (*terminator == ' ' || *terminator == '\0')
  1.3811 -				return SDL_TRUE;
  1.3812 +        terminator = where + SDL_strlen(extension);
  1.3813 +        if (where == start || *(where - 1) == ' ')
  1.3814 +            if (*terminator == ' ' || *terminator == '\0')
  1.3815 +                return SDL_TRUE;
  1.3816  
  1.3817 -		start = terminator;
  1.3818 -	}
  1.3819 -	return SDL_FALSE;
  1.3820 +        start = terminator;
  1.3821 +    }
  1.3822 +    return SDL_FALSE;
  1.3823  #else
  1.3824 -	return SDL_FALSE;
  1.3825 +    return SDL_FALSE;
  1.3826  #endif
  1.3827  }
  1.3828  
  1.3829 @@ -2270,285 +2270,285 @@
  1.3830  SDL_GL_SetAttribute(SDL_GLattr attr, int value)
  1.3831  {
  1.3832  #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
  1.3833 -	int             retval;
  1.3834 +    int retval;
  1.3835  
  1.3836 -	if (!_this) {
  1.3837 -		SDL_UninitializedVideo();
  1.3838 -		return -1;
  1.3839 -	}
  1.3840 -	retval = 0;
  1.3841 -	switch (attr) {
  1.3842 -	case SDL_GL_RED_SIZE:
  1.3843 -		_this->gl_config.red_size = value;
  1.3844 -		break;
  1.3845 -	case SDL_GL_GREEN_SIZE:
  1.3846 -		_this->gl_config.green_size = value;
  1.3847 -		break;
  1.3848 -	case SDL_GL_BLUE_SIZE:
  1.3849 -		_this->gl_config.blue_size = value;
  1.3850 -		break;
  1.3851 -	case SDL_GL_ALPHA_SIZE:
  1.3852 -		_this->gl_config.alpha_size = value;
  1.3853 -		break;
  1.3854 -	case SDL_GL_DOUBLEBUFFER:
  1.3855 -		_this->gl_config.double_buffer = value;
  1.3856 -		break;
  1.3857 -	case SDL_GL_BUFFER_SIZE:
  1.3858 -		_this->gl_config.buffer_size = value;
  1.3859 -		break;
  1.3860 -	case SDL_GL_DEPTH_SIZE:
  1.3861 -		_this->gl_config.depth_size = value;
  1.3862 -		break;
  1.3863 -	case SDL_GL_STENCIL_SIZE:
  1.3864 -		_this->gl_config.stencil_size = value;
  1.3865 -		break;
  1.3866 -	case SDL_GL_ACCUM_RED_SIZE:
  1.3867 -		_this->gl_config.accum_red_size = value;
  1.3868 -		break;
  1.3869 -	case SDL_GL_ACCUM_GREEN_SIZE:
  1.3870 -		_this->gl_config.accum_green_size = value;
  1.3871 -		break;
  1.3872 -	case SDL_GL_ACCUM_BLUE_SIZE:
  1.3873 -		_this->gl_config.accum_blue_size = value;
  1.3874 -		break;
  1.3875 -	case SDL_GL_ACCUM_ALPHA_SIZE:
  1.3876 -		_this->gl_config.accum_alpha_size = value;
  1.3877 -		break;
  1.3878 -	case SDL_GL_STEREO:
  1.3879 -		_this->gl_config.stereo = value;
  1.3880 -		break;
  1.3881 -	case SDL_GL_MULTISAMPLEBUFFERS:
  1.3882 -		_this->gl_config.multisamplebuffers = value;
  1.3883 -		break;
  1.3884 -	case SDL_GL_MULTISAMPLESAMPLES:
  1.3885 -		_this->gl_config.multisamplesamples = value;
  1.3886 -		break;
  1.3887 -	case SDL_GL_ACCELERATED_VISUAL:
  1.3888 -		_this->gl_config.accelerated = value;
  1.3889 -		break;
  1.3890 -	case SDL_GL_RETAINED_BACKING:
  1.3891 -		_this->gl_config.retained_backing = value;
  1.3892 -		break;
  1.3893 -	default:
  1.3894 -		SDL_SetError("Unknown OpenGL attribute");
  1.3895 -		retval = -1;
  1.3896 -		break;
  1.3897 -	}
  1.3898 -	return retval;
  1.3899 +    if (!_this) {
  1.3900 +        SDL_UninitializedVideo();
  1.3901 +        return -1;
  1.3902 +    }
  1.3903 +    retval = 0;
  1.3904 +    switch (attr) {
  1.3905 +    case SDL_GL_RED_SIZE:
  1.3906 +        _this->gl_config.red_size = value;
  1.3907 +        break;
  1.3908 +    case SDL_GL_GREEN_SIZE:
  1.3909 +        _this->gl_config.green_size = value;
  1.3910 +        break;
  1.3911 +    case SDL_GL_BLUE_SIZE:
  1.3912 +        _this->gl_config.blue_size = value;
  1.3913 +        break;
  1.3914 +    case SDL_GL_ALPHA_SIZE:
  1.3915 +        _this->gl_config.alpha_size = value;
  1.3916 +        break;
  1.3917 +    case SDL_GL_DOUBLEBUFFER:
  1.3918 +        _this->gl_config.double_buffer = value;
  1.3919 +        break;
  1.3920 +    case SDL_GL_BUFFER_SIZE:
  1.3921 +        _this->gl_config.buffer_size = value;
  1.3922 +        break;
  1.3923 +    case SDL_GL_DEPTH_SIZE:
  1.3924 +        _this->gl_config.depth_size = value;
  1.3925 +        break;
  1.3926 +    case SDL_GL_STENCIL_SIZE:
  1.3927 +        _this->gl_config.stencil_size = value;
  1.3928 +        break;
  1.3929 +    case SDL_GL_ACCUM_RED_SIZE:
  1.3930 +        _this->gl_config.accum_red_size = value;
  1.3931 +        break;
  1.3932 +    case SDL_GL_ACCUM_GREEN_SIZE:
  1.3933 +        _this->gl_config.accum_green_size = value;
  1.3934 +        break;
  1.3935 +    case SDL_GL_ACCUM_BLUE_SIZE:
  1.3936 +        _this->gl_config.accum_blue_size = value;
  1.3937 +        break;
  1.3938 +    case SDL_GL_ACCUM_ALPHA_SIZE:
  1.3939 +        _this->gl_config.accum_alpha_size = value;
  1.3940 +        break;
  1.3941 +    case SDL_GL_STEREO:
  1.3942 +        _this->gl_config.stereo = value;
  1.3943 +        break;
  1.3944 +    case SDL_GL_MULTISAMPLEBUFFERS:
  1.3945 +        _this->gl_config.multisamplebuffers = value;
  1.3946 +        break;
  1.3947 +    case SDL_GL_MULTISAMPLESAMPLES:
  1.3948 +        _this->gl_config.multisamplesamples = value;
  1.3949 +        break;
  1.3950 +    case SDL_GL_ACCELERATED_VISUAL:
  1.3951 +        _this->gl_config.accelerated = value;
  1.3952 +        break;
  1.3953 +    case SDL_GL_RETAINED_BACKING:
  1.3954 +        _this->gl_config.retained_backing = value;
  1.3955 +        break;
  1.3956 +    default:
  1.3957 +        SDL_SetError("Unknown OpenGL attribute");
  1.3958 +        retval = -1;
  1.3959 +        break;
  1.3960 +    }
  1.3961 +    return retval;
  1.3962  #else
  1.3963 -	SDL_Unsupported();
  1.3964 -	return -1;
  1.3965 -#endif				/* SDL_VIDEO_OPENGL */
  1.3966 +    SDL_Unsupported();
  1.3967 +    return -1;
  1.3968 +#endif /* SDL_VIDEO_OPENGL */
  1.3969  }
  1.3970  
  1.3971  int
  1.3972  SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
  1.3973  {
  1.3974  #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
  1.3975 -	void            (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
  1.3976 -	GLenum          attrib = 0;
  1.3977 +    void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
  1.3978 +    GLenum attrib = 0;
  1.3979  
  1.3980 -	glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
  1.3981 -	if (!glGetIntegervFunc) {
  1.3982 -		return -1;
  1.3983 -	}
  1.3984 -	switch (attr) {
  1.3985 -	case SDL_GL_RETAINED_BACKING:
  1.3986 -		*value = _this->gl_config.retained_backing;
  1.3987 -		return 0;
  1.3988 -	case SDL_GL_RED_SIZE:
  1.3989 -		attrib = GL_RED_BITS;
  1.3990 -		break;
  1.3991 -	case SDL_GL_BLUE_SIZE:
  1.3992 -		attrib = GL_BLUE_BITS;
  1.3993 -		break;
  1.3994 -	case SDL_GL_GREEN_SIZE:
  1.3995 -		attrib = GL_GREEN_BITS;
  1.3996 -		break;
  1.3997 -	case SDL_GL_ALPHA_SIZE:
  1.3998 -		attrib = GL_ALPHA_BITS;
  1.3999 -		break;
  1.4000 -	case SDL_GL_DOUBLEBUFFER:
  1.4001 +    glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
  1.4002 +    if (!glGetIntegervFunc) {
  1.4003 +        return -1;
  1.4004 +    }
  1.4005 +    switch (attr) {
  1.4006 +    case SDL_GL_RETAINED_BACKING:
  1.4007 +        *value = _this->gl_config.retained_backing;
  1.4008 +        return 0;
  1.4009 +    case SDL_GL_RED_SIZE:
  1.4010 +        attrib = GL_RED_BITS;
  1.4011 +        break;
  1.4012 +    case SDL_GL_BLUE_SIZE:
  1.4013 +        attrib = GL_BLUE_BITS;
  1.4014 +        break;
  1.4015 +    case SDL_GL_GREEN_SIZE:
  1.4016 +        attrib = GL_GREEN_BITS;
  1.4017 +        break;
  1.4018 +    case SDL_GL_ALPHA_SIZE:
  1.4019 +        attrib = GL_ALPHA_BITS;
  1.4020 +        break;
  1.4021 +    case SDL_GL_DOUBLEBUFFER:
  1.4022  #ifndef SDL_VIDEO_OPENGL_ES
  1.4023 -		attrib = GL_DOUBLEBUFFER;
  1.4024 -		break;
  1.4025 +        attrib = GL_DOUBLEBUFFER;
  1.4026 +        break;
  1.4027  #else
  1.4028 -		/*
  1.4029 -		 * I believe double buffering is the only option in OpenGL ES
  1.4030 -		 * -- in any case, GL_DOUBLEBUFFER doesn't exist
  1.4031 -		 */
  1.4032 -		*value = 1;
  1.4033 -		return 0;
  1.4034 +        /*
  1.4035 +         * I believe double buffering is the only option in OpenGL ES
  1.4036 +         * -- in any case, GL_DOUBLEBUFFER doesn't exist
  1.4037 +         */
  1.4038 +        *value = 1;
  1.4039 +        return 0;
  1.4040  #endif
  1.4041 -	case SDL_GL_DEPTH_SIZE:
  1.4042 -		attrib = GL_DEPTH_BITS;
  1.4043 -		break;
  1.4044 -	case SDL_GL_STENCIL_SIZE:
  1.4045 -		attrib = GL_STENCIL_BITS;
  1.4046 -		break;
  1.4047 +    case SDL_GL_DEPTH_SIZE:
  1.4048 +        attrib = GL_DEPTH_BITS;
  1.4049 +        break;
  1.4050 +    case SDL_GL_STENCIL_SIZE:
  1.4051 +        attrib = GL_STENCIL_BITS;
  1.4052 +        break;
  1.4053  #ifndef SDL_VIDEO_OPENGL_ES
  1.4054 -	case SDL_GL_ACCUM_RED_SIZE:
  1.4055 -		attrib = GL_ACCUM_RED_BITS;
  1.4056 -		break;
  1.4057 -	case SDL_GL_ACCUM_GREEN_SIZE:
  1.4058 -		attrib = GL_ACCUM_GREEN_BITS;
  1.4059 -		break;
  1.4060 -	case SDL_GL_ACCUM_BLUE_SIZE:
  1.4061 -		attrib = GL_ACCUM_BLUE_BITS;
  1.4062 -		break;
  1.4063 -	case SDL_GL_ACCUM_ALPHA_SIZE:
  1.4064 -		attrib = GL_ACCUM_ALPHA_BITS;
  1.4065 -		break;
  1.4066 -	case SDL_GL_STEREO:
  1.4067 -		attrib = GL_STEREO;
  1.4068 -		break;
  1.4069 +    case SDL_GL_ACCUM_RED_SIZE:
  1.4070 +        attrib = GL_ACCUM_RED_BITS;
  1.4071 +        break;
  1.4072 +    case SDL_GL_ACCUM_GREEN_SIZE:
  1.4073 +        attrib = GL_ACCUM_GREEN_BITS;
  1.4074 +        break;
  1.4075 +    case SDL_GL_ACCUM_BLUE_SIZE:
  1.4076 +        attrib = GL_ACCUM_BLUE_BITS;
  1.4077 +        break;
  1.4078 +    case SDL_GL_ACCUM_ALPHA_SIZE:
  1.4079 +        attrib = GL_ACCUM_ALPHA_BITS;
  1.4080 +        break;
  1.4081 +    case SDL_GL_STEREO:
  1.4082 +        attrib = GL_STEREO;
  1.4083 +        break;
  1.4084  #else
  1.4085 -	case SDL_GL_ACCUM_RED_SIZE:
  1.4086 -	case SDL_GL_ACCUM_GREEN_SIZE:
  1.4087 -	case SDL_GL_ACCUM_BLUE_SIZE:
  1.4088 -	case SDL_GL_ACCUM_ALPHA_SIZE:
  1.4089 -	case SDL_GL_STEREO:
  1.4090 -		/* none of these are supported in OpenGL ES */
  1.4091 -		*value = 0;
  1.4092 -		return 0;
  1.4093 +    case SDL_GL_ACCUM_RED_SIZE:
  1.4094 +    case SDL_GL_ACCUM_GREEN_SIZE:
  1.4095 +    case SDL_GL_ACCUM_BLUE_SIZE:
  1.4096 +    case SDL_GL_ACCUM_ALPHA_SIZE:
  1.4097 +    case SDL_GL_STEREO:
  1.4098 +        /* none of these are supported in OpenGL ES */
  1.4099 +        *value = 0;
  1.4100 +        return 0;
  1.4101  #endif
  1.4102 -	case SDL_GL_MULTISAMPLEBUFFERS:
  1.4103 +    case SDL_GL_MULTISAMPLEBUFFERS:
  1.4104  #ifndef SDL_VIDEO_OPENGL_ES
  1.4105 -		attrib = GL_SAMPLE_BUFFERS_ARB;
  1.4106 +        attrib = GL_SAMPLE_BUFFERS_ARB;
  1.4107  #else
  1.4108 -		attrib = GL_SAMPLE_BUFFERS;
  1.4109 +        attrib = GL_SAMPLE_BUFFERS;
  1.4110  #endif
  1.4111 -		break;
  1.4112 -	case SDL_GL_MULTISAMPLESAMPLES:
  1.4113 +        break;
  1.4114 +    case SDL_GL_MULTISAMPLESAMPLES:
  1.4115  #ifndef SDL_VIDEO_OPENGL_ES
  1.4116 -		attrib = GL_SAMPLES_ARB;
  1.4117 +        attrib = GL_SAMPLES_ARB;
  1.4118  #else
  1.4119 -		attrib = GL_SAMPLES;
  1.4120 +        attrib = GL_SAMPLES;
  1.4121  #endif
  1.4122 -		break;
  1.4123 -	case SDL_GL_BUFFER_SIZE:
  1.4124 -		{
  1.4125 -			GLint           bits = 0;
  1.4126 -			GLint           component;
  1.4127 +        break;
  1.4128 +    case SDL_GL_BUFFER_SIZE:
  1.4129 +        {
  1.4130 +            GLint bits = 0;
  1.4131 +            GLint component;
  1.4132  
  1.4133 -			/*
  1.4134 -			 * there doesn't seem to be a single flag in OpenGL
  1.4135 -			 * for this!
  1.4136 -			 */
  1.4137 -			glGetIntegervFunc(GL_RED_BITS, &component);
  1.4138 -			bits += component;
  1.4139 -			glGetIntegervFunc(GL_GREEN_BITS, &component);
  1.4140 -			bits += component;
  1.4141 -			glGetIntegervFunc(GL_BLUE_BITS, &component);
  1.4142 -			bits += component;
  1.4143 -			glGetIntegervFunc(GL_ALPHA_BITS, &component);
  1.4144 -			bits += component;
  1.4145 +            /*
  1.4146 +             * there doesn't seem to be a single flag in OpenGL
  1.4147 +             * for this!
  1.4148 +             */
  1.4149 +            glGetIntegervFunc(GL_RED_BITS, &component);
  1.4150 +            bits += component;
  1.4151 +            glGetIntegervFunc(GL_GREEN_BITS, &component);
  1.4152 +            bits += component;
  1.4153 +            glGetIntegervFunc(GL_BLUE_BITS, &component);
  1.4154 +            bits += component;
  1.4155 +            glGetIntegervFunc(GL_ALPHA_BITS, &component);
  1.4156 +            bits += component;
  1.4157  
  1.4158 -			*value = bits;
  1.4159 -			return 0;
  1.4160 -		}
  1.4161 -	case SDL_GL_ACCELERATED_VISUAL:
  1.4162 -		{
  1.4163 -			/* FIXME: How do we get this information? */
  1.4164 -			*value = (_this->gl_config.accelerated != 0);
  1.4165 -			return 0;
  1.4166 -		}
  1.4167 -	default:
  1.4168 -		SDL_SetError("Unknown OpenGL attribute");
  1.4169 -		return -1;
  1.4170 -	}
  1.4171 +            *value = bits;
  1.4172 +            return 0;
  1.4173 +        }
  1.4174 +    case SDL_GL_ACCELERATED_VISUAL:
  1.4175 +        {
  1.4176 +            /* FIXME: How do we get this information? */
  1.4177 +            *value = (_this->gl_config.accelerated != 0);
  1.4178 +            return 0;
  1.4179 +        }
  1.4180 +    default:
  1.4181 +        SDL_SetError("Unknown OpenGL attribute");
  1.4182 +        return -1;
  1.4183 +    }
  1.4184  
  1.4185 -	glGetIntegervFunc(attrib, (GLint *) value);
  1.4186 -	return 0;
  1.4187 +    glGetIntegervFunc(attrib, (GLint *) value);
  1.4188 +    return 0;
  1.4189  #else
  1.4190 -	SDL_Unsupported();
  1.4191 -	return -1;
  1.4192 -#endif				/* SDL_VIDEO_OPENGL */
  1.4193 +    SDL_Unsupported();
  1.4194 +    return -1;
  1.4195 +#endif /* SDL_VIDEO_OPENGL */
  1.4196  }
  1.4197  
  1.4198  SDL_GLContext
  1.4199  SDL_GL_CreateContext(SDL_WindowID windowID)
  1.4200  {
  1.4201 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.4202 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.4203  
  1.4204 -	if (!window) {
  1.4205 -		return NULL;
  1.4206 -	}
  1.4207 -	if (!(window->flags & SDL_WINDOW_OPENGL)) {
  1.4208 -		SDL_SetError("The specified window isn't an OpenGL window");
  1.4209 -		return NULL;
  1.4210 -	}
  1.4211 -	return _this->GL_CreateContext(_this, window);
  1.4212 +    if (!window) {
  1.4213 +        return NULL;
  1.4214 +    }
  1.4215 +    if (!(window->flags & SDL_WINDOW_OPENGL)) {
  1.4216 +        SDL_SetError("The specified window isn't an OpenGL window");
  1.4217 +        return NULL;
  1.4218 +    }
  1.4219 +    return _this->GL_CreateContext(_this, window);
  1.4220  }
  1.4221  
  1.4222  int
  1.4223  SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
  1.4224  {
  1.4225 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.4226 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.4227  
  1.4228 -	if (window && !(window->flags & SDL_WINDOW_OPENGL)) {
  1.4229 -		SDL_SetError("The specified window isn't an OpenGL window");
  1.4230 -		return -1;
  1.4231 -	}
  1.4232 -	if (!context) {
  1.4233 -		window = NULL;
  1.4234 -	}
  1.4235 -	return _this->GL_MakeCurrent(_this, window, context);
  1.4236 +    if (window && !(window->flags & SDL_WINDOW_OPENGL)) {
  1.4237 +        SDL_SetError("The specified window isn't an OpenGL window");
  1.4238 +        return -1;
  1.4239 +    }
  1.4240 +    if (!context) {
  1.4241 +        window = NULL;
  1.4242 +    }
  1.4243 +    return _this->GL_MakeCurrent(_this, window, context);
  1.4244  }
  1.4245  
  1.4246  int
  1.4247  SDL_GL_SetSwapInterval(int interval)
  1.4248  {
  1.4249 -	if (!_this) {
  1.4250 -		SDL_UninitializedVideo();
  1.4251 -		return -1;
  1.4252 -	}
  1.4253 -	if (_this->GL_SetSwapInterval) {
  1.4254 -		return _this->GL_SetSwapInterval(_this, interval);
  1.4255 -	} else {
  1.4256 -		SDL_SetError("Setting the swap interval is not supported");
  1.4257 -		return -1;
  1.4258 -	}
  1.4259 +    if (!_this) {
  1.4260 +        SDL_UninitializedVideo();
  1.4261 +        return -1;
  1.4262 +    }
  1.4263 +    if (_this->GL_SetSwapInterval) {
  1.4264 +        return _this->GL_SetSwapInterval(_this, interval);
  1.4265 +    } else {
  1.4266 +        SDL_SetError("Setting the swap interval is not supported");
  1.4267 +        return -1;
  1.4268 +    }
  1.4269  }
  1.4270  
  1.4271  int
  1.4272  SDL_GL_GetSwapInterval(void)
  1.4273  {
  1.4274 -	if (!_this) {
  1.4275 -		SDL_UninitializedVideo();
  1.4276 -		return -1;
  1.4277 -	}
  1.4278 -	if (_this->GL_GetSwapInterval) {
  1.4279 -		return _this->GL_GetSwapInterval(_this);
  1.4280 -	} else {
  1.4281 -		SDL_SetError("Getting the swap interval is not supported");
  1.4282 -		return -1;
  1.4283 -	}
  1.4284 +    if (!_this) {
  1.4285 +        SDL_UninitializedVideo();
  1.4286 +        return -1;
  1.4287 +    }
  1.4288 +    if (_this->GL_GetSwapInterval) {
  1.4289 +        return _this->GL_GetSwapInterval(_this);
  1.4290 +    } else {
  1.4291 +        SDL_SetError("Getting the swap interval is not supported");
  1.4292 +        return -1;
  1.4293 +    }
  1.4294  }
  1.4295  
  1.4296  void
  1.4297  SDL_GL_SwapWindow(SDL_WindowID windowID)
  1.4298  {
  1.4299 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.4300 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.4301  
  1.4302 -	if (!window) {
  1.4303 -		return;
  1.4304 -	}
  1.4305 -	if (!(window->flags & SDL_WINDOW_OPENGL)) {
  1.4306 -		SDL_SetError("The specified window isn't an OpenGL window");
  1.4307 -		return;
  1.4308 -	}
  1.4309 -	_this->GL_SwapWindow(_this, window);
  1.4310 +    if (!window) {
  1.4311 +        return;
  1.4312 +    }
  1.4313 +    if (!(window->flags & SDL_WINDOW_OPENGL)) {
  1.4314 +        SDL_SetError("The specified window isn't an OpenGL window");
  1.4315 +        return;
  1.4316 +    }
  1.4317 +    _this->GL_SwapWindow(_this, window);
  1.4318  }
  1.4319  
  1.4320  void
  1.4321  SDL_GL_DeleteContext(SDL_GLContext context)
  1.4322  {
  1.4323 -	if (!_this || !context) {
  1.4324 -		return;
  1.4325 -	}
  1.4326 -	_this->GL_MakeCurrent(_this, NULL, NULL);
  1.4327 -	_this->GL_DeleteContext(_this, context);
  1.4328 +    if (!_this || !context) {
  1.4329 +        return;
  1.4330 +    }
  1.4331 +    _this->GL_MakeCurrent(_this, NULL, NULL);
  1.4332 +    _this->GL_DeleteContext(_this, context);
  1.4333  }
  1.4334  
  1.4335  #if 0                           // FIXME
  1.4336 @@ -2559,63 +2559,63 @@
  1.4337  static void
  1.4338  CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
  1.4339  {
  1.4340 -	int             x, y;
  1.4341 -	Uint32          colorkey;
  1.4342 +    int x, y;
  1.4343 +    Uint32 colorkey;
  1.4344  #define SET_MASKBIT(icon, x, y, mask) \
  1.4345  	mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
  1.4346  
  1.4347 -	colorkey = icon->format->colorkey;
  1.4348 -	switch (icon->format->BytesPerPixel) {
  1.4349 -	case 1:
  1.4350 -		{
  1.4351 -			Uint8          *pixels;
  1.4352 -			for (y = 0; y < icon->h; ++y) {
  1.4353 -				pixels = (Uint8 *) icon->pixels + y * icon->pitch;
  1.4354 -				for (x = 0; x < icon->w; ++x) {
  1.4355 -					if (*pixels++ == colorkey) {
  1.4356 -						SET_MASKBIT(icon, x, y, mask);
  1.4357 -					}
  1.4358 -				}
  1.4359 -			}
  1.4360 -		}
  1.4361 -		break;
  1.4362 +    colorkey = icon->format->colorkey;
  1.4363 +    switch (icon->format->BytesPerPixel) {
  1.4364 +    case 1:
  1.4365 +        {
  1.4366 +            Uint8 *pixels;
  1.4367 +            for (y = 0; y < icon->h; ++y) {
  1.4368 +                pixels = (Uint8 *) icon->pixels + y * icon->pitch;
  1.4369 +                for (x = 0; x < icon->w; ++x) {
  1.4370 +                    if (*pixels++ == colorkey) {
  1.4371 +                        SET_MASKBIT(icon, x, y, mask);
  1.4372 +                    }
  1.4373 +                }
  1.4374 +            }
  1.4375 +        }
  1.4376 +        break;
  1.4377  
  1.4378 -	case 2:
  1.4379 -		{
  1.4380 -			Uint16         *pixels;
  1.4381 -			for (y = 0; y < icon->h; ++y) {
  1.4382 -				pixels = (Uint16 *) icon->pixels + y * icon->pitch / 2;
  1.4383 -				for (x = 0; x < icon->w; ++x) {
  1.4384 -					if ((flags & 1) && *pixels == colorkey) {
  1.4385 -						SET_MASKBIT(icon, x, y, mask);
  1.4386 -					} else if ((flags & 2)
  1.4387 -						   && (*pixels & icon->format->Amask) == 0) {
  1.4388 -						SET_MASKBIT(icon, x, y, mask);
  1.4389 -					}
  1.4390 -					pixels++;
  1.4391 -				}
  1.4392 -			}
  1.4393 -		}
  1.4394 -		break;
  1.4395 +    case 2:
  1.4396 +        {
  1.4397 +            Uint16 *pixels;
  1.4398 +            for (y = 0; y < icon->h; ++y) {
  1.4399 +                pixels = (Uint16 *) icon->pixels + y * icon->pitch / 2;
  1.4400 +                for (x = 0; x < icon->w; ++x) {
  1.4401 +                    if ((flags & 1) && *pixels == colorkey) {
  1.4402 +                        SET_MASKBIT(icon, x, y, mask);
  1.4403 +                    } else if ((flags & 2)
  1.4404 +                               && (*pixels & icon->format->Amask) == 0) {
  1.4405 +                        SET_MASKBIT(icon, x, y, mask);
  1.4406 +                    }
  1.4407 +                    pixels++;
  1.4408 +                }
  1.4409 +            }
  1.4410 +        }
  1.4411 +        break;
  1.4412  
  1.4413 -	case 4:
  1.4414 -		{
  1.4415 -			Uint32         *pixels;
  1.4416 -			for (y = 0; y < icon->h; ++y) {
  1.4417 -				pixels = (Uint32 *) icon->pixels + y * icon->pitch / 4;
  1.4418 -				for (x = 0; x < icon->w; ++x) {
  1.4419 -					if ((flags & 1) && *pixels == colorkey) {
  1.4420 -						SET_MASKBIT(icon, x, y, mask);
  1.4421 -					} else if ((flags & 2)
  1.4422 -						   && (*pixels & icon->format->Amask) == 0) {
  1.4423 -						SET_MASKBIT(icon, x, y, mask);
  1.4424 -					}
  1.4425 -					pixels++;
  1.4426 -				}
  1.4427 -			}
  1.4428 -		}
  1.4429 -		break;
  1.4430 -	}
  1.4431 +    case 4:
  1.4432 +        {
  1.4433 +            Uint32 *pixels;
  1.4434 +            for (y = 0; y < icon->h; ++y) {
  1.4435 +                pixels = (Uint32 *) icon->pixels + y * icon->pitch / 4;
  1.4436 +                for (x = 0; x < icon->w; ++x) {
  1.4437 +                    if ((flags & 1) && *pixels == colorkey) {
  1.4438 +                        SET_MASKBIT(icon, x, y, mask);
  1.4439 +                    } else if ((flags & 2)
  1.4440 +                               && (*pixels & icon->format->Amask) == 0) {
  1.4441 +                        SET_MASKBIT(icon, x, y, mask);
  1.4442 +                    }
  1.4443 +                    pixels++;
  1.4444 +                }
  1.4445 +            }
  1.4446 +        }
  1.4447 +        break;
  1.4448 +    }
  1.4449  }
  1.4450  
  1.4451  /*
  1.4452 @@ -2624,41 +2624,41 @@
  1.4453  void
  1.4454  SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
  1.4455  {
  1.4456 -	if (icon && _this->SetIcon) {
  1.4457 -		/* Generate a mask if necessary, and create the icon! */
  1.4458 -		if (mask == NULL) {
  1.4459 -			int             mask_len = icon->h * (icon->w + 7) / 8;
  1.4460 -			int             flags = 0;
  1.4461 -			mask = (Uint8 *) SDL_malloc(mask_len);
  1.4462 -			if (mask == NULL) {
  1.4463 -				return;
  1.4464 -			}
  1.4465 -			SDL_memset(mask, ~0, mask_len);
  1.4466 -			if (icon->flags & SDL_SRCCOLORKEY)
  1.4467 -				flags |= 1;
  1.4468 -			if (icon->flags & SDL_SRCALPHA)
  1.4469 -				flags |= 2;
  1.4470 -			if (flags) {
  1.4471 -				CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
  1.4472 -			}
  1.4473 -			_this->SetIcon(_this, icon, mask);
  1.4474 -			SDL_free(mask);
  1.4475 -		} else {
  1.4476 -			_this->SetIcon(_this, icon, mask);
  1.4477 -		}
  1.4478 -	}
  1.4479 +    if (icon && _this->SetIcon) {
  1.4480 +        /* Generate a mask if necessary, and create the icon! */
  1.4481 +        if (mask == NULL) {
  1.4482 +            int mask_len = icon->h * (icon->w + 7) / 8;
  1.4483 +            int flags = 0;
  1.4484 +            mask = (Uint8 *) SDL_malloc(mask_len);
  1.4485 +            if (mask == NULL) {
  1.4486 +                return;
  1.4487 +            }
  1.4488 +            SDL_memset(mask, ~0, mask_len);
  1.4489 +            if (icon->flags & SDL_SRCCOLORKEY)
  1.4490 +                flags |= 1;
  1.4491 +            if (icon->flags & SDL_SRCALPHA)
  1.4492 +                flags |= 2;
  1.4493 +            if (flags) {
  1.4494 +                CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
  1.4495 +            }
  1.4496 +            _this->SetIcon(_this, icon, mask);
  1.4497 +            SDL_free(mask);
  1.4498 +        } else {
  1.4499 +            _this->SetIcon(_this, icon, mask);
  1.4500 +        }
  1.4501 +    }
  1.4502  }
  1.4503  #endif
  1.4504  
  1.4505  SDL_bool
  1.4506 -SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
  1.4507 +SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo *info)
  1.4508  {
  1.4509 -	SDL_Window     *window = SDL_GetWindowFromID(windowID);
  1.4510 +    SDL_Window *window = SDL_GetWindowFromID(windowID);
  1.4511  
  1.4512 -	if (!window || !_this->GetWindowWMInfo) {
  1.4513 -		return SDL_FALSE;
  1.4514 -	}
  1.4515 -	return (_this->GetWindowWMInfo(_this, window, info));
  1.4516 +    if (!window || !_this->GetWindowWMInfo) {
  1.4517 +        return SDL_FALSE;
  1.4518 +    }
  1.4519 +    return (_this->GetWindowWMInfo(_this, window, info));
  1.4520  }
  1.4521  
  1.4522  /* vi: set ts=4 sw=4 expandtab: */