From 2e532afd2baf63096a156251220044409be42802 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 3 Apr 2023 21:41:54 +0200 Subject: [PATCH] Pass const pointers to events SDL_Events are only read. --- app/src/input_manager.c | 3 ++- app/src/input_manager.h | 3 ++- app/src/screen.c | 2 +- app/src/screen.h | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/input_manager.c b/app/src/input_manager.c index c8098ee7..c9e83d48 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -797,7 +797,8 @@ sc_input_manager_process_file(struct sc_input_manager *im, } void -sc_input_manager_handle_event(struct sc_input_manager *im, SDL_Event *event) { +sc_input_manager_handle_event(struct sc_input_manager *im, + const SDL_Event *event) { bool control = im->controller; switch (event->type) { case SDL_TEXTINPUT: diff --git a/app/src/input_manager.h b/app/src/input_manager.h index 46b1160e..b5a762eb 100644 --- a/app/src/input_manager.h +++ b/app/src/input_manager.h @@ -61,6 +61,7 @@ sc_input_manager_init(struct sc_input_manager *im, const struct sc_input_manager_params *params); void -sc_input_manager_handle_event(struct sc_input_manager *im, SDL_Event *event); +sc_input_manager_handle_event(struct sc_input_manager *im, + const SDL_Event *event); #endif diff --git a/app/src/screen.c b/app/src/screen.c index b00b0d05..65a4047d 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -812,7 +812,7 @@ sc_screen_is_mouse_capture_key(SDL_Keycode key) { } bool -sc_screen_handle_event(struct sc_screen *screen, SDL_Event *event) { +sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) { bool relative_mode = sc_screen_is_relative_mode(screen); switch (event->type) { diff --git a/app/src/screen.h b/app/src/screen.h index 4fca04d8..ffb896a7 100644 --- a/app/src/screen.h +++ b/app/src/screen.h @@ -137,7 +137,7 @@ sc_screen_set_rotation(struct sc_screen *screen, unsigned rotation); // react to SDL events // If this function returns false, scrcpy must exit with an error. bool -sc_screen_handle_event(struct sc_screen *screen, SDL_Event *event); +sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event); // convert point from window coordinates to frame coordinates // x and y are expressed in pixels