@ -158,8 +158,8 @@ void *SW_LockBuffer( void )
@@ -158,8 +158,8 @@ void *SW_LockBuffer( void )
void * pixels ;
int stride ;
if ( SDL_LockTexture ( sw . tex , NULL , & pixels , & stride ) )
Sys_Error ( " %s " , SDL_GetError ( ) ) ;
if ( SDL_LockTexture ( sw . tex , NULL , & pixels , & stride ) < 0 )
Sys_Error ( " %s: %s" , __func__ , SDL_GetError ( ) ) ;
return pixels ;
}
@ -272,7 +272,7 @@ static void R_InitVideoModes( void )
@@ -272,7 +272,7 @@ static void R_InitVideoModes( void )
int j ;
SDL_DisplayMode mode ;
if ( SDL_GetDisplayMode ( displayIndex , i , & mode ) )
if ( SDL_GetDisplayMode ( displayIndex , i , & mode ) < 0 )
{
Msg ( " SDL_GetDisplayMode: %s \n " , SDL_GetError ( ) ) ;
continue ;
@ -419,12 +419,16 @@ static qboolean WIN_SetWindowIcon( HICON ico )
@@ -419,12 +419,16 @@ static qboolean WIN_SetWindowIcon( HICON ico )
{
SDL_SysWMinfo wminfo ;
if ( SDL_GetWindowWMInfo ( host . hWnd , & wminfo ) )
SDL_VERSION ( & wminfo . version ) ;
if ( SDL_GetWindowWMInfo ( host . hWnd , & wminfo ) = = SDL_TRUE )
{
SendMessage ( wminfo . info . win . window , WM_SETICON , ICON_SMALL , ( LONG_PTR ) ico ) ;
SendMessage ( wminfo . info . win . window , WM_SETICON , ICON_BIG , ( LONG_PTR ) ico ) ;
return true ;
}
Con_Reportf ( S_ERROR " %s: %s " , __func__ , SDL_GetError ( ) ) ;
return false ;
}
# endif
@ -492,8 +496,8 @@ void GL_UpdateSwapInterval( void )
@@ -492,8 +496,8 @@ void GL_UpdateSwapInterval( void )
{
ClearBits ( gl_vsync . flags , FCVAR_CHANGED ) ;
if ( SDL_GL_SetSwapInterval ( gl_vsync . value ) )
Con_Reportf ( S_ERROR " SDL_GL_SetSwapInterval: %s \n " , SDL_GetError ( ) ) ;
if ( SDL_GL_SetSwapInterval ( gl_vsync . value ) < 0 )
Con_Reportf ( S_ERROR " SDL_GL_SetSwapInterval: %s \n " , SDL_GetError ( ) ) ;
}
# endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
}
@ -542,7 +546,7 @@ GL_UpdateContext
@@ -542,7 +546,7 @@ GL_UpdateContext
static qboolean GL_UpdateContext ( void )
{
# if SDL_VERSION_ATLEAST( 2, 0, 0 )
if ( SDL_GL_MakeCurrent ( host . hWnd , glw_state . context ) )
if ( SDL_GL_MakeCurrent ( host . hWnd , glw_state . context ) < 0 )
{
Con_Reportf ( S_ERROR " GL_UpdateContext: %s \n " , SDL_GetError ( ) ) ;
return GL_DeleteContext ( ) ;
@ -599,7 +603,7 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi
@@ -599,7 +603,7 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi
want . w = width ;
want . h = height ;
if ( SDL_GetClosestDisplayMode ( 0 , & want , & got ) < 0 )
if ( SDL_GetClosestDisplayMode ( 0 , & want , & got ) = = NULL )
{
Con_Printf ( S_ERROR " %s: SDL_GetClosestDisplayMode: %s " , __func__ , SDL_GetError ( ) ) ;
return false ;
@ -1047,7 +1051,7 @@ qboolean R_Init_Video( const int type )
@@ -1047,7 +1051,7 @@ qboolean R_Init_Video( const int type )
// refdll can request some attributes
GL_SetupAttributes ( ) ;
if ( SDL_GL_LoadLibrary ( EGL_LIB ) )
if ( SDL_GL_LoadLibrary ( EGL_LIB ) < 0 )
{
Con_Reportf ( S_ERROR " Couldn't initialize OpenGL: %s \n " , SDL_GetError ( ) ) ;
return false ;
@ -1086,7 +1090,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
@@ -1086,7 +1090,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
# if SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_DisplayMode displayMode ;
SDL_GetCurrentDisplayMode ( 0 , & displayMode ) ;
if ( SDL_GetCurrentDisplayMode ( 0 , & displayMode ) < 0 )
{
Con_Printf ( S_ERROR " SDL_GetCurrentDisplayMode: %s " , SDL_GetError ( ) ) ;
return rserr_invalid_mode ;
}
// check our desktop attributes
refState . desktopBitsPixel = SDL_BITSPERPIXEL ( displayMode . format ) ;
@ -1115,8 +1123,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
@@ -1115,8 +1123,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
VID_RestoreScreenResolution ( ) ;
# if SDL_VERSION_ATLEAST( 2, 0, 0 )
if ( SDL_SetWindowFullscreen ( host . hWnd , 0 ) )
if ( SDL_SetWindowFullscreen ( host . hWnd , 0 ) < 0 )
{
Con_Printf ( S_ERROR " SDL_SetWindowFullscreen: %s " , SDL_GetError ( ) ) ;
return rserr_invalid_fullscreen ;
}
# if SDL_VERSION_ATLEAST( 2, 0, 5 )
SDL_SetWindowResizable ( host . hWnd , SDL_TRUE ) ;
# endif