The parameter to SDL_AppEvent() should be non-const

This allows functions like SDL_ConvertEventToRenderCoordinates() to work without having to copy the event.

Fixes https://github.com/libsdl-org/SDL/issues/10691
This commit is contained in:
Sam Lantinga 2024-09-03 07:45:30 -07:00
parent b1b4a9cd1b
commit 575d9cda6f
20 changed files with 20 additions and 20 deletions

View File

@ -178,7 +178,7 @@ not check the event queue in this function (SDL_AppEvent exists for that).
Next:
```c
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event);
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event);
```
This will be called whenever an SDL event arrives. Your app should not call

View File

@ -51,7 +51,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -83,7 +83,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -65,7 +65,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -56,7 +56,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -305,7 +305,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
SnakeContext *ctx = &((AppState *)appstate)->snake_ctx;
switch (event->type) {

View File

@ -52,7 +52,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -39,7 +39,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -39,7 +39,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -29,7 +29,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */

View File

@ -96,7 +96,7 @@ typedef enum SDL_AppResult
typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate);
typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, const SDL_Event *event);
typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, SDL_Event *event);
typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate);
/**

View File

@ -359,7 +359,7 @@ extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppIterate(void *appstate);
* \sa SDL_AppInit
* \sa SDL_AppIterate
*/
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, const SDL_Event *event);
extern SDLMAIN_DECLSPEC SDL_AppResult SDLCALL SDL_AppEvent(void *appstate, SDL_Event *event);
/**
* App-implemented deinit entry point for SDL_MAIN_USE_CALLBACKS apps.

View File

@ -120,7 +120,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
return (event->type == SDL_EVENT_QUIT) ? SDL_APP_SUCCESS : SDL_APP_CONTINUE;
}

View File

@ -1114,7 +1114,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
static SDL_bool saw_event = SDL_FALSE;
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
Thing *thing = NULL;

View File

@ -149,7 +149,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv)
return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS;

View File

@ -216,7 +216,7 @@ static int FlipCamera(void)
return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
switch (event->type) {
case SDL_EVENT_KEY_DOWN: {

View File

@ -70,7 +70,7 @@ onerror:
return SDL_APP_FAILURE;
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
dropfile_dialog *dialog = appstate;
if (event->type == SDL_EVENT_DROP_BEGIN) {

View File

@ -70,7 +70,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
return SDLTest_CommonEventMainCallbacks(state, event);
}

View File

@ -107,7 +107,7 @@ static Pen *FindPen(SDL_PenID which)
return NULL;
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
Pen *pen = NULL;

View File

@ -551,7 +551,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
}
SDL_AppResult SDL_AppEvent(void *appstate, const SDL_Event *event)
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
return SDLTest_CommonEventMainCallbacks(state, event);
}