Fixed bug 3513 - SDL_GL_SwapWindow does not return error status
authorSam Lantinga <slouken@libsdl.org>
Fri, 09 Dec 2016 01:47:43 -0800
changeset 1069023a825f341e6
parent 10689 69d6c1c7a2bf
child 10691 c02fe6ba1cfd
Fixed bug 3513 - SDL_GL_SwapWindow does not return error status

Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
include/SDL_video.h
src/dynapi/SDL_dynapi_procs.h
src/video/SDL_egl_c.h
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/cocoa/SDL_cocoaopengl.h
src/video/cocoa/SDL_cocoaopengl.m
src/video/directfb/SDL_DirectFB_opengl.c
src/video/directfb/SDL_DirectFB_opengl.h
src/video/haiku/SDL_BWin.h
src/video/haiku/SDL_bclipboard.cc
src/video/haiku/SDL_bclipboard.h
src/video/haiku/SDL_bevents.cc
src/video/haiku/SDL_bevents.h
src/video/haiku/SDL_bframebuffer.cc
src/video/haiku/SDL_bframebuffer.h
src/video/haiku/SDL_bkeyboard.cc
src/video/haiku/SDL_bkeyboard.h
src/video/haiku/SDL_bmodes.cc
src/video/haiku/SDL_bmodes.h
src/video/haiku/SDL_bopengl.cc
src/video/haiku/SDL_bopengl.h
src/video/haiku/SDL_bvideo.cc
src/video/haiku/SDL_bvideo.h
src/video/haiku/SDL_bwindow.cc
src/video/haiku/SDL_bwindow.h
src/video/mir/SDL_miropengl.c
src/video/mir/SDL_miropengl.h
src/video/pandora/SDL_pandora.c
src/video/psp/SDL_pspgl.c
src/video/psp/SDL_pspgl_c.h
src/video/psp/SDL_pspvideo.h
src/video/uikit/SDL_uikitopengles.h
src/video/uikit/SDL_uikitopengles.m
src/video/windows/SDL_windowsopengl.c
src/video/windows/SDL_windowsopengl.h
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11opengl.h
     1.1 --- a/include/SDL_video.h	Fri Dec 09 01:29:52 2016 -0800
     1.2 +++ b/include/SDL_video.h	Fri Dec 09 01:47:43 2016 -0800
     1.3 @@ -1195,7 +1195,7 @@
     1.4   * \brief Swap the OpenGL buffers for a window, if double-buffering is
     1.5   *        supported.
     1.6   */
     1.7 -extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
     1.8 +extern DECLSPEC int SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
     1.9  
    1.10  /**
    1.11   *  \brief Delete an OpenGL context.
     2.1 --- a/src/dynapi/SDL_dynapi_procs.h	Fri Dec 09 01:29:52 2016 -0800
     2.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Fri Dec 09 01:47:43 2016 -0800
     2.3 @@ -595,7 +595,7 @@
     2.4  SDL_DYNAPI_PROC(void,SDL_GL_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
     2.5  SDL_DYNAPI_PROC(int,SDL_GL_SetSwapInterval,(int a),(a),return)
     2.6  SDL_DYNAPI_PROC(int,SDL_GL_GetSwapInterval,(void),(),return)
     2.7 -SDL_DYNAPI_PROC(void,SDL_GL_SwapWindow,(SDL_Window *a),(a),)
     2.8 +SDL_DYNAPI_PROC(int,SDL_GL_SwapWindow,(SDL_Window *a),(a),return)
     2.9  SDL_DYNAPI_PROC(void,SDL_GL_DeleteContext,(SDL_GLContext a),(a),)
    2.10  SDL_DYNAPI_PROC(int,SDL_vsscanf,(const char *a, const char *b, va_list c),(a,b,c),return)
    2.11  SDL_DYNAPI_PROC(int,SDL_GameControllerAddMappingsFromRW,(SDL_RWops *a, int b),(a,b),return)
     3.1 --- a/src/video/SDL_egl_c.h	Fri Dec 09 01:29:52 2016 -0800
     3.2 +++ b/src/video/SDL_egl_c.h	Fri Dec 09 01:47:43 2016 -0800
     3.3 @@ -96,14 +96,14 @@
     3.4  /* These need to be wrapped to get the surface for the window by the platform GLES implementation */
     3.5  extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface);
     3.6  extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context);
     3.7 -extern void SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface);
     3.8 +extern int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface);
     3.9  
    3.10  /* A few of useful macros */
    3.11  
    3.12 -#define SDL_EGL_SwapWindow_impl(BACKEND) void \
    3.13 +#define SDL_EGL_SwapWindow_impl(BACKEND) int \
    3.14  BACKEND ## _GLES_SwapWindow(_THIS, SDL_Window * window) \
    3.15  {\
    3.16 -    SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\
    3.17 +    return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\
    3.18  }
    3.19  
    3.20  #define SDL_EGL_MakeCurrent_impl(BACKEND) int \
     4.1 --- a/src/video/SDL_sysvideo.h	Fri Dec 09 01:29:52 2016 -0800
     4.2 +++ b/src/video/SDL_sysvideo.h	Fri Dec 09 01:47:43 2016 -0800
     4.3 @@ -252,7 +252,7 @@
     4.4      void (*GL_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h);
     4.5      int (*GL_SetSwapInterval) (_THIS, int interval);
     4.6      int (*GL_GetSwapInterval) (_THIS);
     4.7 -    void (*GL_SwapWindow) (_THIS, SDL_Window * window);
     4.8 +    int (*GL_SwapWindow) (_THIS, SDL_Window * window);
     4.9      void (*GL_DeleteContext) (_THIS, SDL_GLContext context);
    4.10  
    4.11      /* * * */
     5.1 --- a/src/video/SDL_video.c	Fri Dec 09 01:29:52 2016 -0800
     5.2 +++ b/src/video/SDL_video.c	Fri Dec 09 01:47:43 2016 -0800
     5.3 @@ -3382,22 +3382,20 @@
     5.4      }
     5.5  }
     5.6  
     5.7 -void
     5.8 +int
     5.9  SDL_GL_SwapWindow(SDL_Window * window)
    5.10  {
    5.11 -    CHECK_WINDOW_MAGIC(window,);
    5.12 +    CHECK_WINDOW_MAGIC(window,-1);
    5.13  
    5.14      if (!(window->flags & SDL_WINDOW_OPENGL)) {
    5.15 -        SDL_SetError("The specified window isn't an OpenGL window");
    5.16 -        return;
    5.17 +        return SDL_SetError("The specified window isn't an OpenGL window");
    5.18      }
    5.19  
    5.20      if (SDL_GL_GetCurrentWindow() != window) {
    5.21 -        SDL_SetError("The specified window has not been made current");
    5.22 -        return;
    5.23 -    }
    5.24 -
    5.25 -    _this->GL_SwapWindow(_this, window);
    5.26 +        return SDL_SetError("The specified window has not been made current");
    5.27 +    }
    5.28 +
    5.29 +    return _this->GL_SwapWindow(_this, window);
    5.30  }
    5.31  
    5.32  void
     6.1 --- a/src/video/cocoa/SDL_cocoaopengl.h	Fri Dec 09 01:29:52 2016 -0800
     6.2 +++ b/src/video/cocoa/SDL_cocoaopengl.h	Fri Dec 09 01:47:43 2016 -0800
     6.3 @@ -58,7 +58,7 @@
     6.4                                       int * w, int * h);
     6.5  extern int Cocoa_GL_SetSwapInterval(_THIS, int interval);
     6.6  extern int Cocoa_GL_GetSwapInterval(_THIS);
     6.7 -extern void Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
     6.8 +extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
     6.9  extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
    6.10  
    6.11  #endif /* SDL_VIDEO_OPENGL_CGL */
     7.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Fri Dec 09 01:29:52 2016 -0800
     7.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Fri Dec 09 01:47:43 2016 -0800
     7.3 @@ -383,13 +383,14 @@
     7.4      return status;
     7.5  }}
     7.6  
     7.7 -void
     7.8 +int
     7.9  Cocoa_GL_SwapWindow(_THIS, SDL_Window * window)
    7.10  { @autoreleasepool
    7.11  {
    7.12      SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext();
    7.13      [nscontext flushBuffer];
    7.14      [nscontext updateIfNeeded];
    7.15 +    return 0;
    7.16  }}
    7.17  
    7.18  void
     8.1 --- a/src/video/directfb/SDL_DirectFB_opengl.c	Fri Dec 09 01:29:52 2016 -0800
     8.2 +++ b/src/video/directfb/SDL_DirectFB_opengl.c	Fri Dec 09 01:47:43 2016 -0800
     8.3 @@ -246,7 +246,7 @@
     8.4      return 0;
     8.5  }
     8.6  
     8.7 -void
     8.8 +int
     8.9  DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
    8.10  {
    8.11      SDL_DFB_WINDOWDATA(window);
    8.12 @@ -273,9 +273,9 @@
    8.13          }
    8.14  
    8.15      SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL,  DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC ));
    8.16 -    return;
    8.17 +    return 0;
    8.18    error:
    8.19 -    return;
    8.20 +    return -1;
    8.21  }
    8.22  
    8.23  void
     9.1 --- a/src/video/directfb/SDL_DirectFB_opengl.h	Fri Dec 09 01:29:52 2016 -0800
     9.2 +++ b/src/video/directfb/SDL_DirectFB_opengl.h	Fri Dec 09 01:47:43 2016 -0800
     9.3 @@ -50,7 +50,7 @@
     9.4                                     SDL_GLContext context);
     9.5  extern int DirectFB_GL_SetSwapInterval(_THIS, int interval);
     9.6  extern int DirectFB_GL_GetSwapInterval(_THIS);
     9.7 -extern void DirectFB_GL_SwapWindow(_THIS, SDL_Window * window);
     9.8 +extern int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window);
     9.9  extern void DirectFB_GL_DeleteContext(_THIS, SDL_GLContext context);
    9.10  
    9.11  extern void DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window);
    10.1 --- a/src/video/haiku/SDL_BWin.h	Fri Dec 09 01:29:52 2016 -0800
    10.2 +++ b/src/video/haiku/SDL_BWin.h	Fri Dec 09 01:47:43 2016 -0800
    10.3 @@ -668,3 +668,5 @@
    10.4   *                         buffer provided by DirectConnected() is invalidated.
    10.5   */
    10.6  #endif
    10.7 +
    10.8 +/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/video/haiku/SDL_bclipboard.cc	Fri Dec 09 01:29:52 2016 -0800
    11.2 +++ b/src/video/haiku/SDL_bclipboard.cc	Fri Dec 09 01:47:43 2016 -0800
    11.3 @@ -93,3 +93,5 @@
    11.4  #endif
    11.5  
    11.6  #endif /* SDL_VIDEO_DRIVER_HAIKU */
    11.7 +
    11.8 +/* vi: set ts=4 sw=4 expandtab: */
    12.1 --- a/src/video/haiku/SDL_bclipboard.h	Fri Dec 09 01:29:52 2016 -0800
    12.2 +++ b/src/video/haiku/SDL_bclipboard.h	Fri Dec 09 01:47:43 2016 -0800
    12.3 @@ -29,3 +29,5 @@
    12.4  extern SDL_bool BE_HasClipboardText(_THIS);
    12.5  
    12.6  #endif
    12.7 +
    12.8 +/* vi: set ts=4 sw=4 expandtab: */
    13.1 --- a/src/video/haiku/SDL_bevents.cc	Fri Dec 09 01:29:52 2016 -0800
    13.2 +++ b/src/video/haiku/SDL_bevents.cc	Fri Dec 09 01:47:43 2016 -0800
    13.3 @@ -37,3 +37,5 @@
    13.4  #endif
    13.5  
    13.6  #endif /* SDL_VIDEO_DRIVER_HAIKU */
    13.7 +
    13.8 +/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- a/src/video/haiku/SDL_bevents.h	Fri Dec 09 01:29:52 2016 -0800
    14.2 +++ b/src/video/haiku/SDL_bevents.h	Fri Dec 09 01:47:43 2016 -0800
    14.3 @@ -35,3 +35,5 @@
    14.4  #endif
    14.5  
    14.6  #endif
    14.7 +
    14.8 +/* vi: set ts=4 sw=4 expandtab: */
    15.1 --- a/src/video/haiku/SDL_bframebuffer.cc	Fri Dec 09 01:29:52 2016 -0800
    15.2 +++ b/src/video/haiku/SDL_bframebuffer.cc	Fri Dec 09 01:47:43 2016 -0800
    15.3 @@ -252,3 +252,5 @@
    15.4  #endif
    15.5  
    15.6  #endif /* SDL_VIDEO_DRIVER_HAIKU */
    15.7 +
    15.8 +/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/src/video/haiku/SDL_bframebuffer.h	Fri Dec 09 01:29:52 2016 -0800
    16.2 +++ b/src/video/haiku/SDL_bframebuffer.h	Fri Dec 09 01:47:43 2016 -0800
    16.3 @@ -43,3 +43,5 @@
    16.4  #endif
    16.5  
    16.6  #endif
    16.7 +
    16.8 +/* vi: set ts=4 sw=4 expandtab: */
    17.1 --- a/src/video/haiku/SDL_bkeyboard.cc	Fri Dec 09 01:29:52 2016 -0800
    17.2 +++ b/src/video/haiku/SDL_bkeyboard.cc	Fri Dec 09 01:47:43 2016 -0800
    17.3 @@ -186,3 +186,5 @@
    17.4  #endif
    17.5  
    17.6  #endif /* SDL_VIDEO_DRIVER_HAIKU */
    17.7 +
    17.8 +/* vi: set ts=4 sw=4 expandtab: */
    18.1 --- a/src/video/haiku/SDL_bkeyboard.h	Fri Dec 09 01:29:52 2016 -0800
    18.2 +++ b/src/video/haiku/SDL_bkeyboard.h	Fri Dec 09 01:47:43 2016 -0800
    18.3 @@ -40,3 +40,5 @@
    18.4  #endif
    18.5  
    18.6  #endif
    18.7 +
    18.8 +/* vi: set ts=4 sw=4 expandtab: */
    19.1 --- a/src/video/haiku/SDL_bmodes.cc	Fri Dec 09 01:29:52 2016 -0800
    19.2 +++ b/src/video/haiku/SDL_bmodes.cc	Fri Dec 09 01:47:43 2016 -0800
    19.3 @@ -329,3 +329,5 @@
    19.4  #endif
    19.5  
    19.6  #endif /* SDL_VIDEO_DRIVER_HAIKU */
    19.7 +
    19.8 +/* vi: set ts=4 sw=4 expandtab: */
    20.1 --- a/src/video/haiku/SDL_bmodes.h	Fri Dec 09 01:29:52 2016 -0800
    20.2 +++ b/src/video/haiku/SDL_bmodes.h	Fri Dec 09 01:47:43 2016 -0800
    20.3 @@ -44,3 +44,5 @@
    20.4  #endif
    20.5  
    20.6  #endif
    20.7 +
    20.8 +/* vi: set ts=4 sw=4 expandtab: */
    21.1 --- a/src/video/haiku/SDL_bopengl.cc	Fri Dec 09 01:29:52 2016 -0800
    21.2 +++ b/src/video/haiku/SDL_bopengl.cc	Fri Dec 09 01:47:43 2016 -0800
    21.3 @@ -38,40 +38,40 @@
    21.4  #define BGL_FLAGS BGL_RGB | BGL_DOUBLE
    21.5  
    21.6  static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
    21.7 -	return ((SDL_BWin*)(window->driverdata));
    21.8 +    return ((SDL_BWin*)(window->driverdata));
    21.9  }
   21.10  
   21.11  static SDL_INLINE SDL_BApp *_GetBeApp() {
   21.12 -	return ((SDL_BApp*)be_app);
   21.13 +    return ((SDL_BApp*)be_app);
   21.14  }
   21.15  
   21.16  /* Passing a NULL path means load pointers from the application */
   21.17  int BE_GL_LoadLibrary(_THIS, const char *path)
   21.18  {
   21.19  /* FIXME: Is this working correctly? */
   21.20 -	image_info info;
   21.21 -			int32 cookie = 0;
   21.22 -	while (get_next_image_info(0, &cookie, &info) == B_OK) {
   21.23 -		void *location = NULL;
   21.24 -		if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
   21.25 -				&location) == B_OK) {
   21.26 +    image_info info;
   21.27 +            int32 cookie = 0;
   21.28 +    while (get_next_image_info(0, &cookie, &info) == B_OK) {
   21.29 +        void *location = NULL;
   21.30 +        if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
   21.31 +                &location) == B_OK) {
   21.32  
   21.33 -			_this->gl_config.dll_handle = (void *) info.id;
   21.34 -			_this->gl_config.driver_loaded = 1;
   21.35 -			SDL_strlcpy(_this->gl_config.driver_path, "libGL.so",
   21.36 -					SDL_arraysize(_this->gl_config.driver_path));
   21.37 -		}
   21.38 -	}
   21.39 -	return 0;
   21.40 +            _this->gl_config.dll_handle = (void *) info.id;
   21.41 +            _this->gl_config.driver_loaded = 1;
   21.42 +            SDL_strlcpy(_this->gl_config.driver_path, "libGL.so",
   21.43 +                    SDL_arraysize(_this->gl_config.driver_path));
   21.44 +        }
   21.45 +    }
   21.46 +    return 0;
   21.47  }
   21.48  
   21.49  void *BE_GL_GetProcAddress(_THIS, const char *proc)
   21.50  {
   21.51 -	if (_this->gl_config.dll_handle != NULL) {
   21.52 -		void *location = NULL;
   21.53 -		status_t err;
   21.54 -		if ((err =
   21.55 -			get_image_symbol((image_id) _this->gl_config.dll_handle,
   21.56 +    if (_this->gl_config.dll_handle != NULL) {
   21.57 +        void *location = NULL;
   21.58 +        status_t err;
   21.59 +        if ((err =
   21.60 +            get_image_symbol((image_id) _this->gl_config.dll_handle,
   21.61                                proc, B_SYMBOL_TYPE_ANY,
   21.62                                &location)) == B_OK) {
   21.63              return location;
   21.64 @@ -79,52 +79,53 @@
   21.65                  SDL_SetError("Couldn't find OpenGL symbol");
   21.66                  return NULL;
   21.67          }
   21.68 -	} else {
   21.69 -		SDL_SetError("OpenGL library not loaded");
   21.70 -		return NULL;
   21.71 -	}
   21.72 +    } else {
   21.73 +        SDL_SetError("OpenGL library not loaded");
   21.74 +        return NULL;
   21.75 +    }
   21.76  }
   21.77  
   21.78  
   21.79  
   21.80  
   21.81 -void BE_GL_SwapWindow(_THIS, SDL_Window * window) {
   21.82 +int BE_GL_SwapWindow(_THIS, SDL_Window * window) {
   21.83      _ToBeWin(window)->SwapBuffers();
   21.84 +    return 0;
   21.85  }
   21.86  
   21.87  int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
   21.88 -	_GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
   21.89 -	return 0;
   21.90 +    _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
   21.91 +    return 0;
   21.92  }
   21.93  
   21.94  
   21.95  SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) {
   21.96 -	/* FIXME: Not sure what flags should be included here; may want to have
   21.97 -	   most of them */
   21.98 -	SDL_BWin *bwin = _ToBeWin(window);
   21.99 -	bwin->CreateGLView(BGL_FLAGS);
  21.100 -	return (SDL_GLContext)(bwin);
  21.101 +    /* FIXME: Not sure what flags should be included here; may want to have
  21.102 +       most of them */
  21.103 +    SDL_BWin *bwin = _ToBeWin(window);
  21.104 +    bwin->CreateGLView(BGL_FLAGS);
  21.105 +    return (SDL_GLContext)(bwin);
  21.106  }
  21.107  
  21.108  void BE_GL_DeleteContext(_THIS, SDL_GLContext context) {
  21.109 -	/* Currently, automatically unlocks the view */
  21.110 -	((SDL_BWin*)context)->RemoveGLView();
  21.111 +    /* Currently, automatically unlocks the view */
  21.112 +    ((SDL_BWin*)context)->RemoveGLView();
  21.113  }
  21.114  
  21.115  
  21.116  int BE_GL_SetSwapInterval(_THIS, int interval) {
  21.117 -	/* TODO: Implement this, if necessary? */
  21.118 -	return 0;
  21.119 +    /* TODO: Implement this, if necessary? */
  21.120 +    return 0;
  21.121  }
  21.122  
  21.123  int BE_GL_GetSwapInterval(_THIS) {
  21.124 -	/* TODO: Implement this, if necessary? */
  21.125 -	return 0;
  21.126 +    /* TODO: Implement this, if necessary? */
  21.127 +    return 0;
  21.128  }
  21.129  
  21.130  
  21.131  void BE_GL_UnloadLibrary(_THIS) {
  21.132 -	/* TODO: Implement this, if necessary? */
  21.133 +    /* TODO: Implement this, if necessary? */
  21.134  }
  21.135  
  21.136  
  21.137 @@ -132,17 +133,17 @@
  21.138     mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not
  21.139     currently in use. */
  21.140  void BE_GL_RebootContexts(_THIS) {
  21.141 -	SDL_Window *window = _this->windows;
  21.142 -	while(window) {
  21.143 -		SDL_BWin *bwin = _ToBeWin(window);
  21.144 -		if(bwin->GetGLView()) {
  21.145 -			bwin->LockLooper();
  21.146 -			bwin->RemoveGLView();
  21.147 -			bwin->CreateGLView(BGL_FLAGS);
  21.148 -			bwin->UnlockLooper();
  21.149 -		}
  21.150 -		window = window->next;
  21.151 -	}
  21.152 +    SDL_Window *window = _this->windows;
  21.153 +    while(window) {
  21.154 +        SDL_BWin *bwin = _ToBeWin(window);
  21.155 +        if(bwin->GetGLView()) {
  21.156 +            bwin->LockLooper();
  21.157 +            bwin->RemoveGLView();
  21.158 +            bwin->CreateGLView(BGL_FLAGS);
  21.159 +            bwin->UnlockLooper();
  21.160 +        }
  21.161 +        window = window->next;
  21.162 +    }
  21.163  }
  21.164  
  21.165  
  21.166 @@ -217,3 +218,5 @@
  21.167  #endif
  21.168  
  21.169  #endif /* SDL_VIDEO_DRIVER_HAIKU */
  21.170 +
  21.171 +/* vi: set ts=4 sw=4 expandtab: */
    22.1 --- a/src/video/haiku/SDL_bopengl.h	Fri Dec 09 01:29:52 2016 -0800
    22.2 +++ b/src/video/haiku/SDL_bopengl.h	Fri Dec 09 01:47:43 2016 -0800
    22.3 @@ -36,7 +36,7 @@
    22.4                                SDL_GLContext context);
    22.5  extern int BE_GL_SetSwapInterval(_THIS, int interval);                  /* TODO */
    22.6  extern int BE_GL_GetSwapInterval(_THIS);                                /* TODO */
    22.7 -extern void BE_GL_SwapWindow(_THIS, SDL_Window * window);
    22.8 +extern int BE_GL_SwapWindow(_THIS, SDL_Window * window);
    22.9  extern SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window);
   22.10  extern void BE_GL_DeleteContext(_THIS, SDL_GLContext context);
   22.11  
   22.12 @@ -47,3 +47,5 @@
   22.13  #endif
   22.14  
   22.15  #endif
   22.16 +
   22.17 +/* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/video/haiku/SDL_bvideo.cc	Fri Dec 09 01:29:52 2016 -0800
    23.2 +++ b/src/video/haiku/SDL_bvideo.cc	Fri Dec 09 01:47:43 2016 -0800
    23.3 @@ -173,3 +173,5 @@
    23.4  #endif
    23.5  
    23.6  #endif /* SDL_VIDEO_DRIVER_HAIKU */
    23.7 +
    23.8 +/* vi: set ts=4 sw=4 expandtab: */
    24.1 --- a/src/video/haiku/SDL_bvideo.h	Fri Dec 09 01:29:52 2016 -0800
    24.2 +++ b/src/video/haiku/SDL_bvideo.h	Fri Dec 09 01:47:43 2016 -0800
    24.3 @@ -40,3 +40,5 @@
    24.4  #endif
    24.5  
    24.6  #endif
    24.7 +
    24.8 +/* vi: set ts=4 sw=4 expandtab: */
    25.1 --- a/src/video/haiku/SDL_bwindow.cc	Fri Dec 09 01:29:52 2016 -0800
    25.2 +++ b/src/video/haiku/SDL_bwindow.cc	Fri Dec 09 01:47:43 2016 -0800
    25.3 @@ -227,3 +227,5 @@
    25.4  #endif
    25.5  
    25.6  #endif /* SDL_VIDEO_DRIVER_HAIKU */
    25.7 +
    25.8 +/* vi: set ts=4 sw=4 expandtab: */
    26.1 --- a/src/video/haiku/SDL_bwindow.h	Fri Dec 09 01:29:52 2016 -0800
    26.2 +++ b/src/video/haiku/SDL_bwindow.h	Fri Dec 09 01:47:43 2016 -0800
    26.3 @@ -52,3 +52,4 @@
    26.4  
    26.5  #endif
    26.6  
    26.7 +/* vi: set ts=4 sw=4 expandtab: */
    27.1 --- a/src/video/mir/SDL_miropengl.c	Fri Dec 09 01:29:52 2016 -0800
    27.2 +++ b/src/video/mir/SDL_miropengl.c	Fri Dec 09 01:47:43 2016 -0800
    27.3 @@ -31,12 +31,12 @@
    27.4  
    27.5  #include "SDL_mirdyn.h"
    27.6  
    27.7 -void
    27.8 +int
    27.9  MIR_GL_SwapWindow(_THIS, SDL_Window* window)
   27.10  {
   27.11      MIR_Window* mir_wind = window->driverdata;
   27.12  
   27.13 -    SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface);
   27.14 +    return SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface);
   27.15  }
   27.16  
   27.17  int
    28.1 --- a/src/video/mir/SDL_miropengl.h	Fri Dec 09 01:29:52 2016 -0800
    28.2 +++ b/src/video/mir/SDL_miropengl.h	Fri Dec 09 01:47:43 2016 -0800
    28.3 @@ -34,7 +34,7 @@
    28.4  #define MIR_GL_GetSwapInterval SDL_EGL_GetSwapInterval
    28.5  #define MIR_GL_SetSwapInterval SDL_EGL_SetSwapInterval
    28.6  
    28.7 -extern void
    28.8 +extern int
    28.9  MIR_GL_SwapWindow(_THIS, SDL_Window* window);
   28.10  
   28.11  extern int
    29.1 --- a/src/video/pandora/SDL_pandora.c	Fri Dec 09 01:29:52 2016 -0800
    29.2 +++ b/src/video/pandora/SDL_pandora.c	Fri Dec 09 01:47:43 2016 -0800
    29.3 @@ -774,15 +774,14 @@
    29.4      return ((SDL_VideoData *) _this->driverdata)->swapinterval;
    29.5  }
    29.6  
    29.7 -void
    29.8 +int
    29.9  PND_gl_swapwindow(_THIS, SDL_Window * window)
   29.10  {
   29.11      SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
   29.12      SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
   29.13  
   29.14      if (phdata->egl_initialized != SDL_TRUE) {
   29.15 -        SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
   29.16 -        return;
   29.17 +        return SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
   29.18      }
   29.19  
   29.20      /* Many applications do not uses glFinish(), so we call it for them */
   29.21 @@ -792,6 +791,7 @@
   29.22      eglWaitGL();
   29.23  
   29.24      eglSwapBuffers(phdata->egl_display, wdata->gles_surface);
   29.25 +    return 0;
   29.26  }
   29.27  
   29.28  void
    30.1 --- a/src/video/psp/SDL_pspgl.c	Fri Dec 09 01:29:52 2016 -0800
    30.2 +++ b/src/video/psp/SDL_pspgl.c	Fri Dec 09 01:47:43 2016 -0800
    30.3 @@ -174,10 +174,11 @@
    30.4      return _this->gl_data->swapinterval;
    30.5  }
    30.6  
    30.7 -void
    30.8 +int
    30.9  PSP_GL_SwapWindow(_THIS, SDL_Window * window)
   30.10  {
   30.11      eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface);
   30.12 +    return 0;
   30.13  }
   30.14  
   30.15  void
    31.1 --- a/src/video/psp/SDL_pspgl_c.h	Fri Dec 09 01:29:52 2016 -0800
    31.2 +++ b/src/video/psp/SDL_pspgl_c.h	Fri Dec 09 01:47:43 2016 -0800
    31.3 @@ -40,7 +40,7 @@
    31.4  extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context);
    31.5  extern void PSP_GL_SwapBuffers(_THIS);
    31.6  
    31.7 -extern void PSP_GL_SwapWindow(_THIS, SDL_Window * window);
    31.8 +extern int PSP_GL_SwapWindow(_THIS, SDL_Window * window);
    31.9  extern SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window);
   31.10  
   31.11  extern int PSP_GL_LoadLibrary(_THIS, const char *path);
    32.1 --- a/src/video/psp/SDL_pspvideo.h	Fri Dec 09 01:29:52 2016 -0800
    32.2 +++ b/src/video/psp/SDL_pspvideo.h	Fri Dec 09 01:47:43 2016 -0800
    32.3 @@ -88,7 +88,7 @@
    32.4  int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
    32.5  int PSP_GL_SetSwapInterval(_THIS, int interval);
    32.6  int PSP_GL_GetSwapInterval(_THIS);
    32.7 -void PSP_GL_SwapWindow(_THIS, SDL_Window * window);
    32.8 +int PSP_GL_SwapWindow(_THIS, SDL_Window * window);
    32.9  void PSP_GL_DeleteContext(_THIS, SDL_GLContext context);
   32.10  
   32.11  /* PSP on screen keyboard */
    33.1 --- a/src/video/uikit/SDL_uikitopengles.h	Fri Dec 09 01:29:52 2016 -0800
    33.2 +++ b/src/video/uikit/SDL_uikitopengles.h	Fri Dec 09 01:47:43 2016 -0800
    33.3 @@ -27,7 +27,7 @@
    33.4                                  SDL_GLContext context);
    33.5  extern void UIKit_GL_GetDrawableSize(_THIS, SDL_Window * window,
    33.6                                       int * w, int * h);
    33.7 -extern void UIKit_GL_SwapWindow(_THIS, SDL_Window * window);
    33.8 +extern int UIKit_GL_SwapWindow(_THIS, SDL_Window * window);
    33.9  extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window);
   33.10  extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context);
   33.11  extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc);
    34.1 --- a/src/video/uikit/SDL_uikitopengles.m	Fri Dec 09 01:29:52 2016 -0800
    34.2 +++ b/src/video/uikit/SDL_uikitopengles.m	Fri Dec 09 01:47:43 2016 -0800
    34.3 @@ -111,7 +111,7 @@
    34.4      return 0;
    34.5  }
    34.6  
    34.7 -void UIKit_GL_SwapWindow(_THIS, SDL_Window * window)
    34.8 +int UIKit_GL_SwapWindow(_THIS, SDL_Window * window)
    34.9  {
   34.10      @autoreleasepool {
   34.11          SDLEAGLContext *context = (__bridge SDLEAGLContext *) SDL_GL_GetCurrentContext();
   34.12 @@ -127,6 +127,7 @@
   34.13           * We don't pump events here because we don't want iOS application events
   34.14           * (low memory, terminate, etc.) to happen inside low level rendering. */
   34.15      }
   34.16 +    return 0;
   34.17  }
   34.18  
   34.19  SDL_GLContext
    35.1 --- a/src/video/windows/SDL_windowsopengl.c	Fri Dec 09 01:29:52 2016 -0800
    35.2 +++ b/src/video/windows/SDL_windowsopengl.c	Fri Dec 09 01:47:43 2016 -0800
    35.3 @@ -766,12 +766,15 @@
    35.4      return retval;
    35.5  }
    35.6  
    35.7 -void
    35.8 +int
    35.9  WIN_GL_SwapWindow(_THIS, SDL_Window * window)
   35.10  {
   35.11      HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
   35.12  
   35.13 -    SwapBuffers(hdc);
   35.14 +    if (!SwapBuffers(hdc)) {
   35.15 +        return WIN_SetError("SwapBuffers()");
   35.16 +    }
   35.17 +    return 0;
   35.18  }
   35.19  
   35.20  void
    36.1 --- a/src/video/windows/SDL_windowsopengl.h	Fri Dec 09 01:29:52 2016 -0800
    36.2 +++ b/src/video/windows/SDL_windowsopengl.h	Fri Dec 09 01:47:43 2016 -0800
    36.3 @@ -62,7 +62,7 @@
    36.4                                SDL_GLContext context);
    36.5  extern int WIN_GL_SetSwapInterval(_THIS, int interval);
    36.6  extern int WIN_GL_GetSwapInterval(_THIS);
    36.7 -extern void WIN_GL_SwapWindow(_THIS, SDL_Window * window);
    36.8 +extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window);
    36.9  extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context);
   36.10  extern void WIN_GL_InitExtensions(_THIS);
   36.11  extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Window * toWindow);
    37.1 --- a/src/video/x11/SDL_x11opengl.c	Fri Dec 09 01:29:52 2016 -0800
    37.2 +++ b/src/video/x11/SDL_x11opengl.c	Fri Dec 09 01:47:43 2016 -0800
    37.3 @@ -783,13 +783,14 @@
    37.4      }
    37.5  }
    37.6  
    37.7 -void
    37.8 +int
    37.9  X11_GL_SwapWindow(_THIS, SDL_Window * window)
   37.10  {
   37.11      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   37.12      Display *display = data->videodata->display;
   37.13  
   37.14      _this->gl_data->glXSwapBuffers(display, data->xwindow);
   37.15 +    return 0;
   37.16  }
   37.17  
   37.18  void
    38.1 --- a/src/video/x11/SDL_x11opengl.h	Fri Dec 09 01:29:52 2016 -0800
    38.2 +++ b/src/video/x11/SDL_x11opengl.h	Fri Dec 09 01:47:43 2016 -0800
    38.3 @@ -63,7 +63,7 @@
    38.4                                SDL_GLContext context);
    38.5  extern int X11_GL_SetSwapInterval(_THIS, int interval);
    38.6  extern int X11_GL_GetSwapInterval(_THIS);
    38.7 -extern void X11_GL_SwapWindow(_THIS, SDL_Window * window);
    38.8 +extern int X11_GL_SwapWindow(_THIS, SDL_Window * window);
    38.9  extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
   38.10  
   38.11  #endif /* SDL_VIDEO_OPENGL_GLX */