Change return type from void to int, for functions that set an error

(SDL_SetError(), SDL_OutOfMemory(), SDL_Unsupported(), SDL_InvalidParam())

Update prototype to forward errors to generic layer, for the functions:
MoveCursor, WarpMouse, GL_DeleteContext, GetDisplayModes.

Check invalid parameter in SDL_SetTextInputRect() generic layer.
This commit is contained in:
Sylvain
2023-02-06 20:24:12 +01:00
committed by Sam Lantinga
parent 6c37d5b57f
commit c5c94a6be6
100 changed files with 472 additions and 389 deletions

View File

@@ -42,7 +42,7 @@
static SDL_Cursor *RPI_CreateDefaultCursor(void);
static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y);
static int RPI_ShowCursor(SDL_Cursor *cursor);
static void RPI_MoveCursor(SDL_Cursor *cursor);
static int RPI_MoveCursor(SDL_Cursor *cursor);
static void RPI_FreeCursor(SDL_Cursor *cursor);
static SDL_Cursor *global_cursor;
@@ -283,9 +283,9 @@ static int RPI_WarpMouseGlobal(float x, float y)
return RPI_WarpMouseGlobalGraphically(x, y);
}
static void RPI_WarpMouse(SDL_Window *window, float x, float y)
static int RPI_WarpMouse(SDL_Window *window, float x, float y)
{
RPI_WarpMouseGlobal(x, y);
return RPI_WarpMouseGlobal(x, y);
}
void RPI_InitMouse(_THIS)
@@ -310,12 +310,12 @@ void RPI_QuitMouse(_THIS)
}
/* This is called when a mouse motion event occurs */
static void RPI_MoveCursor(SDL_Cursor *cursor)
static int RPI_MoveCursor(SDL_Cursor *cursor)
{
SDL_Mouse *mouse = SDL_GetMouse();
/* We must NOT call SDL_SendMouseMotion() on the next call or we will enter recursivity,
* so we create a version of WarpMouseGlobal without it. */
RPI_WarpMouseGlobalGraphically(mouse->x, mouse->y);
return RPI_WarpMouseGlobalGraphically(mouse->x, mouse->y);
}
#endif /* SDL_VIDEO_DRIVER_RPI */

View File

@@ -61,7 +61,7 @@ struct SDL_WindowData
/* Display and window functions */
int RPI_VideoInit(_THIS);
void RPI_VideoQuit(_THIS);
void RPI_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
int RPI_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
int RPI_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
int RPI_CreateWindow(_THIS, SDL_Window *window);
int RPI_CreateWindowFrom(_THIS, SDL_Window *window, const void *data);
@@ -86,6 +86,6 @@ int RPI_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
int RPI_GLES_SetSwapInterval(_THIS, int interval);
int RPI_GLES_GetSwapInterval(_THIS);
int RPI_GLES_SwapWindow(_THIS, SDL_Window *window);
void RPI_GLES_DeleteContext(_THIS, SDL_GLContext context);
int RPI_GLES_DeleteContext(_THIS, SDL_GLContext context);
#endif /* SDL_rpivideo_h */