mirror of https://github.com/libsdl-org/SDL
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:
parent
b1b4a9cd1b
commit
575d9cda6f
|
@ -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
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue